You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by mariomueller <mm...@muellermario.de> on 2009/07/10 07:03:30 UTC

Reuse generated PDF (fileOutputStream)

Hi everybody,

I just found samples where the generated PDF is stored to file. How can I
reuse the generated PDF within my java programm?

Thanks, Regards
Mario
-- 
View this message in context: http://www.nabble.com/Reuse-generated-PDF-%28fileOutputStream%29-tp24421859p24421859.html
Sent from the FOP - Dev mailing list archive at Nabble.com.


Re: Reuse generated PDF (fileOutputStream)

Posted by Andreas Delmelle <an...@telenet.be>.
On 10 Jul 2009, at 07:03, mariomueller wrote:

Hi Mario

As a small note: your question actually belongs more on the fop-users@  
list. fop-dev@ is meant for development /on/ FOP. Development /with/  
FOP is also considered 'usage'.

Try to keep that in mind for the future. Thanks!

> I just found samples where the generated PDF is stored to file. How  
> can I
> reuse the generated PDF within my java programm?

If you're using FOP embedded into another application, you can pass  
any type of OutputStream to FopFactory.newFOP(), so you could dump the  
PDF into a ByteArrayOutputStream, and later on re-use it like

InputStream pdfIn = new ByteArrayInputStream(fopOut.toByteArray());

Something similar is demonstrated here:
http://xmlgraphics.apache.org/fop/0.95/output.html#pdf-postprocess

where the ByteArrayOutputStream's backing byte-array is passed to  
iText's PdfReader constructor, and it is iText that ultimately writes  
the file.


HTH!

Regards,

Andreas Delmelle
mailto:andreas.delmelle.AT.telenet.be
jabber: mandreas@jabber.org
skype: adlm0608

---