I have tried that. When I replace the line
PdfStamper stamper = new PdfStamper(reader, bos);
with
PdfStamper stamper = new PdfStamper(reader, new
FileOutputStream(result));
I get a new pdf in that directory, still with the same error. I guess there
actually 2 problems, getting rid of the error and figuring out how to serve
pdf to browser.
any help is much appreciated.
Steve Cole-6 wrote:
>
> I didn't see a problem with your code in the original post. Have you tried
> dumping the ByteOutputStream to a file see what the pdf looks like? Could
> be
> how you're trying to get the contents of your ByteOutputStream to the
> servlet response OutputStream.
>
>
> ----- Original Message -----
> From: "wmhfitz" <[email protected]>
> To: <[email protected]>
> Sent: Friday, December 19, 2008 9:17 AM
> Subject: Re: [iText-questions] The document has no pages.
>
>
>>
>> I removed the line
>> writer = writer.getInstance(document, bos);
>> That was not supposed to be there, it was left over from trying different
>> things to get pdf to the browser.
>>
>> But with that said, I still get the same error and the following message
>> displayed on screen.
>>
>> Instead of saying "it's bound to fail" do you have any real suggestions
>> of
>> what is I need to change to accomplish this?
>>
>>
>> 1T3XT info wrote:
>> >
>> > wmhfitz wrote:
>> >> This same code works fine in a standalone.
>> >
>> >> PdfStamper stamper = new PdfStamper(reader, bos);
>> >> writer = writer.getInstance(document, bos);
>> >
>> > What is bos? A ByteArrayOutputStream?
>> > Why are you writing to it from PdfStamper AND PdfWriter?
>> > This is bound to fail.
>> > --
>> > This answer is provided by 1T3XT BVBA
>> > http://www.1t3xt.com/ - http://www.1t3xt.info
>> >
>>
>> --------------------------------------------------------------------------
> ----
>> > _______________________________________________
>> > iText-questions mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/itext-questions
>> >
>> > Buy the iText book: http://www.1t3xt.com/docs/book.php
>> >
>> >
>>
>> --
>> View this message in context:
> http://www.nabble.com/The-document-has-no-pages.-tp21080269p21092018.html
>> Sent from the iText - General mailing list archive at Nabble.com.
>>
>>
>> --------------------------------------------------------------------------
> ----
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.1t3xt.com/docs/book.php
>>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>
>
--
View this message in context:
http://www.nabble.com/The-document-has-no-pages.-tp21080269p21092802.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php