Finally I succeed with this code:

http://drifted.in/other/MultiPagePDFTranscoder.java

It is based on a default PDFTranscoder with a simple loop. I suppose there
is a room for additional improvements...

With this code I am getting ca 15% time reduction for two page outputs. Not
much, but I am satisfied :-)

Jan


> -----Original Message-----
> From: honyk [mailto:j.tosov...@email.cz]
> Sent: Wednesday, April 17, 2013 8:24 PM
> To: fop-dev@xmlgraphics.apache.org
> Subject: RE: [OT] Multi-page support in PDFTranscoder
> 
> > So if I understand well, you are using FOP but not using FO.
> 
> Exactly.
> 
> > So, why not just use FO to do that?
> 
> This was my original approach, but I ran into troubles with memory
> leaks. It
> is described here:
> http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-
> users/201202.mbox/%
> 3C00c101ccf39a$08fbe1e0$1af3a5a0$@tosov...@email.cz%3E
> 
> Additionally, in case of FO I had to
> - store image streams into temporary files
> - generate temporary FO with all images linked
> 
> 
> Currently I prefer as efficient conversion as possible.
> 
> I've already deciphered by what class that super.transcode(document,
> uri,
> output) is called - it is Batik's org.apache.batik.transcoder.
> SVGAbstractTranscoder.
> 
> In meantime I've also found this promising thread:
> http://apache-fop.1065347.n5.nabble.com/Generating-a-PDF-by-drawing-to-
> PDFDo
> cumentGraphics2D-td17954.html
> 
> Now I investigate it further.
> 
> Jan
> 
> 
> > -----Original Message-----
> > From: Luis Bernardo [mailto:lmpmberna...@gmail.com]
> > Sent: Tuesday, April 16, 2013 12:44 AM
> > To: fop-dev@xmlgraphics.apache.org
> > Subject: Re: [OT] Multi-page support in PDFTranscoder
> >
> >
> > So if I understand well, you are using FOP but not using FO. And you
> > want to merge multiple PDF pages which are generated from SVG
> sources.
> > So, why not just use FO to do that? If you look at
> > examples/fo/svg/external.fo you will quickly see how to do that.
> >
> > On 4/11/13 8:48 PM, honyk wrote:
> > > Dear All,
> > >
> > > in my app I generate multipage PDFs from SVG sources. Currently I
> use
> > Fop's
> > > PDF Transcoder and all individual PDF pages (byte streams) merge
> > together
> > > using PDFBox.
> > >
> > > I am considering extending the org.apache.fop.svg.PDFTranscoder
> class
> > to
> > > enable passing document array into the transcode method and to
> avoid
> > another
> > > dependency or, better, inefficiency.
> > >
> > > protected void transcode(Document[] documents, String uri,
> > TranscoderOutput
> > > output) {
> > >    // my code
> > > }
> > >
> > > But analyzing the code I am not sure if something like this is even
> > > possible. E.g. this line is completely unclear to me (there is no
> > transcode
> > > method in the AbstractFOPTranscoder):
> > >
> > > super.transcode(document, uri, output);
> > >
> > > To be honest, I don't understand well how the final PDF file is
> > generated
> > > from input SVG nor the way how to intervene into this process and
> > insert a
> > > page break followed by another page.
> > >
> > > Can be transcoder modified this way or it would be too complicated?
> > >
> > > Thanks for any hints,
> > >
> > > Jan
> 


Reply via email to