Skip to main content

Print Doc/Pdf file using Box-node-sdk


Hello,

I’ve integrated Box into my applications and have been utilizing it for several months. Currently, I display all the files using Box URLs within an iframe. Additionally, I’ve implemented a download option using the getDownloadURL function, allowing users to download PDFs or DOC files, which they can then print using their Office 365 apps.

Our new requirement is to streamline the process by providing users with a direct print option within our application, eliminating the need to download the file first. We’ve attempted to achieve this by obtaining the download URL and employing JavaScript code for printing, but unfortunately, we have been unsuccessful.

Can you guide us to achieve this feature.

Thank you in advance for any assistance you can provide.

3 replies

rbarbosa Box
  • Developer Advocate
  • 553 replies
  • May 3, 2024

Hi @hgupta007

I’m not sure how you are displaying the files on an iframe, but now that you want to print them directly that might be a little trickier.

Are you displaying the box.com app inside an iframe, or using box embedded?

Our UI Elements do have a print function, like for example our content preview element.

Help me understand your use case a bit better.


  • Author
  • New Participant
  • 2 replies
  • May 6, 2024

Hi @rbarbosa,

We are using embed url to display from that we recieve from below link:
Link

We use the preview url from above function and put it into src of an iframe to display selected file.

Can we print files by using box-node-sdk, or do we need to install box-ui-elements?


rbarbosa Box
  • Developer Advocate
  • 553 replies
  • May 9, 2024

Hi @hgupta007

You will need something that actually runs on the browser, so I don’t think the SDK will actually help you, unless I’m missing something on your use case.

The preview UI element does hava a print button that will trigger the print.

If that is not an option you can always implement your own javascript print. Perhaps opening the PDF on another tab and trigger the browser print?


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings