webtom wrote:
> Hi,
> 
> i want to print a pdf file silently via java code but the following
> exception is thrown by document.close(): ExceptionConverter:
> java.io.IOException: The document has no pages.

If this is the code you are using:
> try {
>       PdfWriter writer = PdfWriter.getInstance(document, baos);
>       document.open();
>       writer.addJavaScript("this.print(false);", false); //for silently 
> printing
>       document.close();
> } catch (Exception e) {
>       e.printStackTrace();
> }

Then you are creating a PDF with no content.
If you look at the iText documentation, you are missing step 4
(search 'Creating a PDF in 5 steps with iText').
br,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to