You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2011/04/13 13:37:23 UTC

Fop 0.95: Generation of multiple PDFs on a single template

Hi,
  We've been using FOP for a while to generate PDFs. Basicallly we generated
a PDF for every one of our customers, so we have developed a procedure to
generate a XML file for each customer, and then we generate the PDF invoking
FOP with the XML and a templated. That's a long process, since we need to
create the XML and invoke FOP for each customer. Is there any way a template
can generated multiple PDF from a single file? IOW, what I've now is the
following:
<XML>
<CUSTOMER>
[...]
</CUSTOMER>

So I would like to have multiple customers on a file:
<XML>
<CUSTOMERS>
<CUSTOMER>
[...]
</CUSTOMER>
<CUSTOMER>
[...]
</CUSTOMER>
<CUSTOMER>
[...]
</CUSTOMER>
</CUSTOMERS>

And pass that file and the template to the FOP engine, and generate a PDF
for each one of the CUSTOMER. Any thoughts on how I can do that?

Thanks

Jose L.

RE: Fop 0.95: Generation of multiple PDFs on a single template

Posted by Eric Douglas <ed...@blockhouse.com>.
If you're running FOP from a command line that would require either you
split that XML into multiple files or they add an enhancement to the FOP
call.
If you're running FOP from embedded code you could split that XML
yourself into multiple objects and transform into multiple PDFs without
creating any additional files for the XML, though without some sort of
FOP enhancement it would still require multiple calls to the FO
transform to get the PDFs.

________________________________

From: JOSE L MARTINEZ-AVIAL [mailto:jlmagc@gmail.com] 
Sent: Wednesday, April 13, 2011 1:05 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Fop 0.95: Generation of multiple PDFs on a single template


I agree with you about that option. Right now we use a service provided
by a third party that receives a XML file with info for 500 clients, and
it creates 500 pdfs. It is propietary, using Adobe InDesign for the
creation of the template, and we would like to switch to FOP for that
process, but we find that we need to change the process to generate one
XML for each customer. So I think it would be a nice addittion too.

Regards

Jose Luis


2011/4/13 Andreas L. Delmelle <an...@telenet.be>


	On 13 Apr 2011, at 18:51, Andreas L. Delmelle wrote:
	
	> On 13 Apr 2011, at 13:37, JOSE L MARTINEZ-AVIAL wrote:
	
	>> ... That's a long process, since we need to create the XML
and invoke FOP for each customer.
	> <snip />
	
	> As far as I know, you would definitely have to resort to a
two-step approach.
	>
	> I see two possible routes:
	
	
	Forgot to add the bottom line: there is currently no way to
avoid invoking FOP multiple times if you need multiple outputs, unless
by post-processing the PDF with another tool.
	Come to think of it, that could be a nice addition: a config
option that triggers creation of separate PDFs for, say each
fo:page-sequence...
	


	Regards
	
	Andreas
	---
	
---------------------------------------------------------------------
	To unsubscribe, e-mail:
fop-users-unsubscribe@xmlgraphics.apache.org
	For additional commands, e-mail:
fop-users-help@xmlgraphics.apache.org
	
	



Re: Fop 0.95: Generation of multiple PDFs on a single template

Posted by JOSE L MARTINEZ-AVIAL <jl...@gmail.com>.
I agree with you about that option. Right now we use a service provided by a
third party that receives a XML file with info for 500 clients, and it
creates 500 pdfs. It is propietary, using Adobe InDesign for the creation of
the template, and we would like to switch to FOP for that process, but we
find that we need to change the process to generate one XML for each
customer. So I think it would be a nice addittion too.

Regards

Jose Luis

2011/4/13 Andreas L. Delmelle <an...@telenet.be>

> On 13 Apr 2011, at 18:51, Andreas L. Delmelle wrote:
>
> > On 13 Apr 2011, at 13:37, JOSE L MARTINEZ-AVIAL wrote:
> >> ... That's a long process, since we need to create the XML and invoke
> FOP for each customer.
> > <snip />
> > As far as I know, you would definitely have to resort to a two-step
> approach.
> >
> > I see two possible routes:
>
> Forgot to add the bottom line: there is currently no way to avoid invoking
> FOP multiple times if you need multiple outputs, unless by post-processing
> the PDF with another tool.
> Come to think of it, that could be a nice addition: a config option that
> triggers creation of separate PDFs for, say each fo:page-sequence...
>
>
> Regards
>
> Andreas
> ---
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

Re: Fop 0.95: Generation of multiple PDFs on a single template

Posted by "Andreas L. Delmelle" <an...@telenet.be>.
On 13 Apr 2011, at 18:51, Andreas L. Delmelle wrote:

> On 13 Apr 2011, at 13:37, JOSE L MARTINEZ-AVIAL wrote:
>> ... That's a long process, since we need to create the XML and invoke FOP for each customer.
> <snip />
> As far as I know, you would definitely have to resort to a two-step approach. 
> 
> I see two possible routes:

Forgot to add the bottom line: there is currently no way to avoid invoking FOP multiple times if you need multiple outputs, unless by post-processing the PDF with another tool.
Come to think of it, that could be a nice addition: a config option that triggers creation of separate PDFs for, say each fo:page-sequence...


Regards

Andreas
---
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fop 0.95: Generation of multiple PDFs on a single template

Posted by "Andreas L. Delmelle" <an...@telenet.be>.
On 13 Apr 2011, at 13:37, JOSE L MARTINEZ-AVIAL wrote:

Hi Jose

> We've been using FOP for a while to generate PDFs. Basicallly we generated a PDF for every one of our customers, so we have developed a procedure to generate a XML file for each customer, and then we generate the PDF invoking FOP with the XML and a templated. That's a long process, since we need to create the XML and invoke FOP for each customer.

> Is there any way a template can generated multiple PDF from a single file?

As far as I know, you would definitely have to resort to a two-step approach. 

I see two possible routes:
a) generate separate FOs for each customer: in XSLT 1.0 you will need an extension function for that, while with XSLT 2.0 you can use xsl:result-document to produce multiple result trees with a single stylesheet. Each of the FOs should then be processed with FOP separately.

b) generate one FOP Intermediate Format(*) file, and process that output with a second stylesheet to separate the customer page-sets into individual IFs. Those can then each be fed to FOP, to arrive at roughly the same result as a).

(*) see: http://xmlgraphics.apache.org/fop/1.0/intermediate.html


Hope this helps!

Regards

Andreas
---
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org