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 CalvinD <ce...@hacc.edu> on 2006/05/11 22:06:01 UTC
on the fly PDF creation from object array
I have the servlet working to create a PDF from an object list created from
our database. I am writing the .xml to a file and them reading it back in
which seems counterproductive.
Is there a way to create the PDF on the fly without writing the xml to a
file first.
Thanks
Calvn
--
View this message in context: http://www.nabble.com/on-the-fly-PDF-creation-from-object-array-t1603618.html#a4347896
Sent from the FOP - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: on the fly PDF creation from object array
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
You're going to be fine with 0.92beta. Only if the PDFs are getting too
big you might want to consider FOP Trunk for it fixes a problem with
erroneously embedded color profiles.
You can also monitor the following file to see what we're changing in
FOP Trunk:
http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/status.xml
HTML page with the same info but with some delay:
http://xmlgraphics.apache.org/fop/changes.html
On 12.05.2006 12:24:42 CalvinD wrote:
>
> Thanks for both feedbacks. I am certainly learning a lot in a very short
> time. I really appreciate your patience for a new user.
> Jeremias, would it be best if I used the trunk code or the 0.92. I started
> using the 92 branch.
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: on the fly PDF creation from object array
Posted by CalvinD <ce...@hacc.edu>.
Thanks for both feedbacks. I am certainly learning a lot in a very short
time. I really appreciate your patience for a new user.
Jeremias, would it be best if I used the trunk code or the 0.92. I started
using the 92 branch.
Thanks
Calvin
--
View this message in context: http://www.nabble.com/on-the-fly-PDF-creation-from-object-array-t1603618.html#a4355807
Sent from the FOP - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: on the fly PDF creation from object array
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I'm sorry, Jay, but that's not much better than a temporary file. What
you do here is serialize the generated XSL-FO to an XML file and then
parse it back from memory. The only difference is that the temporary
file is not written to disk but is kept in memory.
If you want to build an efficient data flow, please study the examples
here:
http://xmlgraphics.apache.org/fop/latest/embedding.html#examples
It's a step-by-step guide that shows how to link multiple transformation
steps together using SAX. Using SAX you can avoid serialization and
reparsing of the intermediate products. The output of the previous step
is fed directly into the next step.
On 11.05.2006 23:46:16 Jay Bryant wrote:
> > I have the servlet working to create a PDF from an object list created
> from
> > our database. I am writing the .xml to a file and them reading it back in
> > which seems counterproductive.
> > Is there a way to create the PDF on the fly without writing the xml to a
> > file first.
> > Thanks
> > Calvn
>
> Write the results into an output stream. Then convert the output stream into
> an input stream and convert that into PDF.
>
> I wrote a servlet to take the output from Saxon and turn it into input for
> FOP. Here's the relevant chunk:
>
> // Here's where the output from Saxon becomes the input for FOP.
> ByteArrayOutputStream transformResult = transformXML(transform, source,
> req, res);
> if (transformResult.size() == 0)
> {
> res.getOutputStream().println("Transform produced no output");
> }
> else
> {
> ByteArrayInputStream transformStream = new
> ByteArrayInputStream(transformResult.toByteArray());
> makePDF(transformStream, res);
> }
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: on the fly PDF creation from object array
Posted by Jay Bryant <ja...@bryantcs.com>.
> I have the servlet working to create a PDF from an object list created
from
> our database. I am writing the .xml to a file and them reading it back in
> which seems counterproductive.
> Is there a way to create the PDF on the fly without writing the xml to a
> file first.
> Thanks
> Calvn
Write the results into an output stream. Then convert the output stream into
an input stream and convert that into PDF.
I wrote a servlet to take the output from Saxon and turn it into input for
FOP. Here's the relevant chunk:
// Here's where the output from Saxon becomes the input for FOP.
ByteArrayOutputStream transformResult = transformXML(transform, source,
req, res);
if (transformResult.size() == 0)
{
res.getOutputStream().println("Transform produced no output");
}
else
{
ByteArrayInputStream transformStream = new
ByteArrayInputStream(transformResult.toByteArray());
makePDF(transformStream, res);
}
HTH
Jay Bryant
Bryant Communication Services
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org