Looks like the jars are not being found in the classpath. Your embedded
example is run from the command line or in a web container?
On 11/26/12 12:44 AM, Jonathan Seng wrote:
Thank you.
No, I used the ones last mentioned on the mailing list. The link did not seem
right, but I haven't seen any documentation on this.
The latest version fixed the stand-alone / command-line test.
Unfortunately, the embedded usage (only tested on windows) with all four .jars
included (as well as the FOP 1.1 .jars) is throwing the following exceptions:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
org/apache/pdfbox/pdmodel/encryption/BadSecurityHandlerException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.xmlgraphics.util.Service.providers(Service.java:85)
at
org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry.discoverClasspathImplementations(ImageImplRegistry.java:107)
at
org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry.<init>(ImageImplRegistry.java:79)
at
org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry.<init>(ImageImplRegistry.java:88)
at
org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry.getDefaultInstance(ImageImplRegistry.java:97)
at
org.apache.xmlgraphics.image.loader.ImageManager.<init>(ImageManager.java:63)
at org.apache.fop.apps.FopFactory.<init>(FopFactory.java:178)
at org.apache.fop.apps.FopFactory.newInstance(FopFactory.java:190)
…
Caused by: java.lang.ClassNotFoundException:
org.apache.pdfbox.pdmodel.encryption.BadSecurityHandlerException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 53 more
Am I missing something else?
Thank you,
Jonathan
On Nov 25, 2012, at 4:29 PM, Luis Bernardo wrote:
I tried your example in a Mac, with exactly the same version of Java you have,
and it worked with no problems. I assume that by stand alone you mean command
line (that is how I ran it).
Did you get the fop-pdf-images plugin from
https://dist.apache.org/repos/dist/dev/xmlgraphics/binaries/?
On 11/25/12 11:32 PM, Jonathan Seng wrote:
Hello,
I am trying to use fox:external-document to include pdf files using FOP 1.1.
I am doing this embedded, but have reproduced the problems in a stand-alone
test case.
The embedded problems appear on Apple Java 1.6.0_37 64 bit and Oracle Java
1.6.0_34 on Windows 64. The stand-alone test case was only run on the Apple
Java (listed above).
The first problem was previously mentioned on the mailing list: The
fop-pdf-images JAR being required. If this is required, it should be included
or documented clear as day (especially on the extensions.html documentation
page for fox:external-document).
After including all four .jars from the fop-pdf-images download, I get the
following exception:
Exception in thread "main" java.lang.VerifyError: (class:
org/apache/fop/render/pdf/pdfbox/PDFBoxAdapter, method: cloneForNewDocument signature:
(Ljava/lang/Object;Ljava/lang/Object;Ljava/util/Collection;)Ljava/lang/Object;)
Incompatible argument to function
at
org.apache.fop.render.pdf.pdfbox.AbstractPDFBoxHandler.createFormForPDF(AbstractPDFBoxHandler.java:90)
at
org.apache.fop.render.pdf.pdfbox.PDFBoxImageHandler.handleImage(PDFBoxImageHandler.java:57)
at
org.apache.fop.render.intermediate.AbstractIFPainter.drawImage(AbstractIFPainter.java:228)
at
org.apache.fop.render.intermediate.AbstractIFPainter.drawImage(AbstractIFPainter.java:184)
at
org.apache.fop.render.intermediate.AbstractIFPainter.drawImageUsingImageHandler(AbstractIFPainter.java:149)
at
org.apache.fop.render.intermediate.AbstractIFPainter.drawImageUsingURI(AbstractIFPainter.java:271)
at org.apache.fop.render.pdf.PDFPainter.drawImage(PDFPainter.java:150)
at
org.apache.fop.render.intermediate.IFRenderer.drawImage(IFRenderer.java:1272)
at
org.apache.fop.render.intermediate.IFRenderer.renderImage(IFRenderer.java:1259)
at
org.apache.fop.render.AbstractRenderer.renderInlineViewport(AbstractRenderer.java:816)
at
org.apache.fop.render.AbstractPathOrientedRenderer.renderInlineViewport(AbstractPathOrientedRenderer.java:785)
at
org.apache.fop.render.intermediate.IFRenderer.renderInlineViewport(IFRenderer.java:866)
at
org.apache.fop.render.AbstractRenderer.renderInlineArea(AbstractRenderer.java:678)
at
org.apache.fop.render.intermediate.IFRenderer.renderInlineArea(IFRenderer.java:913)
at
org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.java:643)
at
org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:561)
at
org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:598)
at
org.apache.fop.render.intermediate.IFRenderer.renderBlock(IFRenderer.java:980)
at
org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:546)
at
org.apache.fop.render.AbstractRenderer.renderFlow(AbstractRenderer.java:451)
at
org.apache.fop.render.AbstractPathOrientedRenderer.renderFlow(AbstractPathOrientedRenderer.java:738)
at
org.apache.fop.render.AbstractRenderer.renderMainReference(AbstractRenderer.java:428)
at
org.apache.fop.render.AbstractRenderer.renderBodyRegion(AbstractRenderer.java:352)
at
org.apache.fop.render.AbstractRenderer.renderRegionViewport(AbstractRenderer.java:299)
at
org.apache.fop.render.intermediate.IFRenderer.renderRegionViewport(IFRenderer.java:748)
at
org.apache.fop.render.AbstractRenderer.renderPageAreas(AbstractRenderer.java:273)
at
org.apache.fop.render.AbstractRenderer.renderPage(AbstractRenderer.java:238)
at
org.apache.fop.render.intermediate.IFRenderer.renderPage(IFRenderer.java:597)
at
org.apache.fop.area.RenderPagesModel.addPage(RenderPagesModel.java:123)
at
org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage(AbstractPageSequenceLayoutManager.java:312)
at
org.apache.fop.layoutmgr.ExternalDocumentLayoutManager.makePageForImage(ExternalDocumentLayoutManager.java:173)
at
org.apache.fop.layoutmgr.ExternalDocumentLayoutManager.activateLayout(ExternalDocumentLayoutManager.java:116)
at
org.apache.fop.area.AreaTreeHandler.endExternalDocument(AreaTreeHandler.java:289)
at
org.apache.fop.fo.extensions.ExternalDocument.endOfNode(ExternalDocument.java:99)
at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:347)
at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:181)
at
org.apache.xml.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:261)
at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1399)
at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393)
at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2281)
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1367)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262)
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
at org.apache.fop.cli.Main.startFOP(Main.java:177)
at org.apache.fop.cli.Main.main(Main.java:208)
Command used: fop -xml data.xml -xsl output.xsl -pdf output.pdf
data.xml:
--------
<?xml version="1.0" encoding="UTF-8" ?>
<documents>
<pdf src="input.pdf"/>
</documents>
output.xsl:
--------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:apply-templates select="documents/pdf"/>
</fo:root>
</xsl:template>
<xsl:template match="pdf">
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:value-of select="'Including PDF: '"/>
<xsl:value-of select="@src"/>
</fo:block>
<fo:block>
<xsl:value-of select="'Document starts on next page'"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
<fox:external-document>
<xsl:attribute name="content-type">pdf</xsl:attribute>
<xsl:attribute name="src">url('<xsl:value-of
select="@src"/>')</xsl:attribute>
</fox:external-document>
</xsl:template>
</xsl:stylesheet>
Is there anything I can do to make this work?
Thank you,
Jonathan
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org