Hello!
I've searched the mailing lists and the docs but i somehow couldn't find
help.
I'm using fop to generate PDFs in my web-application, but i also need
preview-pictures to display via HTML.
Generating PDFs via FOP works great, but i can't manage to get more than the
first page as a preview.
Here's my code:
private int getImagesFromPDF(String path, Reader stylesheet) throws
Exception
{
FileOutputStream output = new FileOutputStream(path + ".png");
//Instantiate FOP
FopFactory fopFactory = FopFactory.newInstance();
fopFactory.setSourceResolution(96);
fopFactory.setBaseURL(VISITE_BASE_PATH);
try
{
fopFactory.setUserConfig(VISITE_BASE_PATH + "fop_config2.xml");
}
catch (SAXException e)
{
e.printStackTrace();
}
Fop fop = fopFactory.newFop(MimeConstants.MIME_PNG, output);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
// get the right input format for conversion
Source style = new StreamSource(stylesheet);
Result res = new SAXResult(fop.getDefaultHandler());
// Step 6: Start XSLT transformation and FOP processing
transformer.transform(style, res);
return 0;
}
and my fop_config-file:
<fop version="1.0">
<renderers>
<renderer mime="image/png">
<fonts>
<!-- register a particular font -->
<font-triplet name="Georgia" style="normal" weight="normal"/>
<font-triplet name="Georgia" style="normal" weight="bold"/>
<font-triplet name="Georgia" style="italic" weight="normal"/>
<font-triplet name="Georgia" style="italic" weight="bold"/>
</fonts>
</renderer>
</renderers>
</fop>
Any help would be appreciated!
Thx in advance!
--
View this message in context:
http://www.nabble.com/HowTo-export-several-pages-to-PNG-format-tp22800402p22800402.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]