File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PDFBox printing issue

 
Stan F Smith
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stan F Smith
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear,

I dont suppose you could point me to an example?

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic