rorostar wrote:
> It seemed that when creating a PdfStamper, there is a PdfWriter created
> inside of it.
> Since I have a different PdfWriter that I created for the main PDF file, i
> tried to redirect the output of the PdfWriter inside of the PdfStamper to
> the main PdfWriter.
> Is this not supposed to work?

No.

> writer.getDirectContent().add(stamper.getOverContent(1));
> I get java.lang.RuntimeException: Inconsistent writers. Are you mixing two
> documents?

You are mixing two documents. That's not supposed to work.

> Is the only solution to write the PdfStamper to a temp file, and then open
> it later to copy it?

You don't have to create a temp file on disk, you can create it in 
memory. Depending on your exact requirements, you may not need 
PdfWriter, maybe you can work with PdfStamper.insertPage().

Most of the times, there are plenty of ways to achieve the same goal; 
this is also true for iText. But your first attempt to concatenate 
OutputStream was very wrong, because that's like concatenating the bytes 
of different PDF files as if PDF was plain text. That's not how to do it.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-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

Reply via email to