How to print and/or save a PDF?

Added by Vincenzo Romano 20 days ago

Hi all.
I am experimenting with WPdfImage class.
What I actually need is to have the PDF document to go to the client printing menu and to remain on the server local storage.
Accordingly to the example, I get a "download" event from the browser.
But, is there a way to have it sent to the browser's media="print"?
And what about having it as a local resource for storage on the server as a file?

TALIA!


Replies (2)

RE: How to print and/or save a PDF? - Added by Wim Dumon 19 days ago

Hey Vincenzo,

I don't know of a method that would immediately open the print dialog for a pdf file. A quick google search didn't yield much promissing results neither.

What you can do in Wt is:
  • save the pdf in some location on the server, and use a WFileResource (in combination with WAnchor) to make it available in one particular session
  • control if the pdf should be displayed in the browser, or in a helper application (WResource::setDispositionType)
  • suggest the filename for the file on the client (WResource::suggestFilename).
  • open the file in a new tab (WAnchor::setTarget)

Wim.

RE: How to print and/or save a PDF? - Added by Vincenzo Romano 19 days ago

I have found this but I am still far from a solution.

(1-2/2)