aspose file tools*
The moose likes Other Open Source Projects and the fly likes PDFBox printing issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "PDFBox printing issue" Watch "PDFBox printing issue" New topic
Author

PDFBox printing issue

Stan F Smith
Greenhorn

Joined: Jun 28, 2011
Posts: 20
Hello,
We are trying to use PDFBox to open a print dialog box using a stream. I works, however the dialog box that opens is actually on the server.
Has anyone used this before and managed to get it to work?

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

Well of course it's going to open on the server, that's where the software is running.

If you want users to be able to get the file on their own systems you'll need to stream the PDF as a response to a request.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stan F Smith
Greenhorn

Joined: Jun 28, 2011
Posts: 20
Thanks Bear,

I dont suppose you could point me to an example?

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

The servlets forum likely has many examples of streaming binary data.

Essentially, you will set the content headers (content-type and content-disposition) and then write the bytes out to the response output stream.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Here's an example from the Ranch's FAQ: http://www.coderanch.com/how-to/java/ImageServlet. It looks like it's talking about images but if you scroll down a bit you'll see how it can be used to stream any file to the browser. (Including PDF of course.)

It doesn't tell you how to write that PDF so that it pops up a print dialog when it opens in the browser, but maybe that's already been done. And I don't know if that was your question anyway.
Stan F Smith
Greenhorn

Joined: Jun 28, 2011
Posts: 20
Thanks,
That URL example doesn't seem to open.
I am using wicket not servlets, would it work the same way?

Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PDFBox printing issue