xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Apache FOP: Different Problems with embedding PDFs
Date Tue, 15 Apr 2008 07:45:40 GMT
On 10.04.2008 16:57:30 Oliver Hirschi wrote:
> Hi there
> 
> I have different problems with embedding PDFs using apache fop 0.95beta 
> and fop-pdf-images-1.2-bin. I made several tests with the reference pdf 
> "PXR-OutputTest_SPOT_20d_x3.pdf" of 
> http://www.pdfx-ready.ch/files/PXR-OutputTest_SPOT_20d.zip.
> 
> I had the following problems:
> -----------------------------
> 1. I tried to definie the embedding like 
> "t:\__Oli\000\PXR-OutputTest_SPOT_20d_x3.pdf#page=1" or "...#page=2" 
> and "...#page=3", but there is always embedding the first page. Du to 
> that, I split the pages of the reference document (for the following 
> tests) into three documents - One document for every page.

This happens if the URI is invalid which in your case it is. Strictly
speaking a normal file name is not a valid URI. FOP is quite lenient
about it normally but in the case of extracting the "page" parameter I'm
currently just using java.net.URI to parse the URI. And that class is
pretty strict about syntax. Of course, this could be improved.
Suggestions/patches are welcome. I've changed ImageUtil so it notifies
the user about invalid URIs as a minimal help in this area:
http://svn.apache.org/viewvc?rev=648144&view=rev

In your case, use the following instead:
file:///t:/__Oli/000/PXR-OutputTest_SPOT_20d_x3.pdf#page=3

Also, if there are spaces in the URI, they currently need to be escaped
using "%20".

> 2. The first page of the reference pdf can be embedded with fop with no 
> errors. I don't know something about the quality of the embedded pdf at 
> the moment, but it did not happen any errors :-)

The quality isn't changed during the conversion. The PDF objects are
just transferred (if everything is fully supported by the PDF extension).

> 3. The second page can not be embedded. There happens the exception 
> (see below *1) in fop.

I can reproduce that but the correction will take more time for which I
currently don't have time. At least one problem is a string object that
has an object number. That's something that is currently not supported.
That alone would be easy to fix but the string contains characters
outside US-ASCII encoding which triggers Unicode handling in FOP. But
since this particular string is a lookup table for an index color space
the conversion damages this table. FOP (or the PDF extension) needs to
support strings making use of the full "PDFEncoding" character set.

> 4. The third page can be embedded without errors, but the genarated pdf 
> can not be opened with adobe reader (Error 110)

I haven't been able to put my finger on this one, yet. Probably needs a
different PDF parser with better feedback to identify the problem.
Acrobat is horrible in this regard.

> 5. With the newely versions fop 0.95beta and fop-pdf-images-1.2-bin, I 
> can not ebbed TIFF graphics. There happens the exception (see below *2) 
> in fop. With fop 0.94, the same graphic could be embedded well.

You've already got that answered by Peter.

> Is there any help for that?
> In the next days, I will do the same tests with Antennahouse. Are there 
> the same problems to expect?
>
> Thanks & kind regards,
> Oliver Hirschi
> 
> 
> *1)
> ----------
> 10.04.2008 16:39:17 org.apache.fop.area.RenderPagesModel addPage
> SCHWERWIEGEND: Error while rendering page 1
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> org.apache.fop.pdf.PDFObject
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:102)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:81)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:115)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:102)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:81)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.transferDict(PDFBoxAdapter.java:187)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:134)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:102)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:81)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:142)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:81)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:142)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.cloneForNewDocument(PDFBoxAdapter.java:81)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.createFormFromPDFBoxPage(PDFBoxAdapter.java:200)
> at 
> org.apache.fop.render.pdf.pdfbox.PDFBoxPDFImageHandler.generateImage(PDFBoxPDFImageHandler.java:93)
> at 
> org.apache.fop.render.pdf.PDFRenderer.putImage(PDFRenderer.java:1745)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderImage(PDFRenderer.java:1679)
> at 
> org.apache.fop.render.AbstractRenderer.renderViewport(AbstractRenderer.java:734)
> at 
> org.apache.fop.render.AbstractPathOrientedRenderer.renderViewport(AbstractPathOrientedRenderer.java:557)
> at 
> org.apache.fop.render.AbstractRenderer.renderInlineArea(AbstractRenderer.java:617)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderInlineArea(PDFRenderer.java:1345)
> at 
> org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.java:592)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderLineArea(PDFRenderer.java:1336)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:529)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:564)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderBlock(PDFRenderer.java:1329)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:519)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:564)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderBlock(PDFRenderer.java:1329)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:519)
> at 
> org.apache.fop.render.AbstractPathOrientedRenderer.renderBlockViewport(AbstractPathOrientedRenderer.java:478)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:546)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderBlock(PDFRenderer.java:1329)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:519)
> at 
> org.apache.fop.render.AbstractRenderer.renderFlow(AbstractRenderer.java:424)
> at 
> org.apache.fop.render.AbstractRenderer.renderMainReference(AbstractRenderer.java:403)
> at 
> org.apache.fop.render.AbstractRenderer.renderBodyRegion(AbstractRenderer.java:337)
> at 
> org.apache.fop.render.AbstractRenderer.renderRegionViewport(AbstractRenderer.java:282)
> at 
> org.apache.fop.render.AbstractRenderer.renderPageAreas(AbstractRenderer.java:255)
> at 
> org.apache.fop.render.AbstractRenderer.renderPage(AbstractRenderer.java:229)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderPage(PDFRenderer.java:801)
> at 
> org.apache.fop.area.RenderPagesModel.addPage(RenderPagesModel.java:113)
> at 
> org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage(AbstractPageSequenceLayoutManager.java:312)
> at 
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequenceLayoutManager.java:167)
> at 
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:108)
> at 
> org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:234)
> at 
> org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:123)
> at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:340)
> at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169)
> at 
> com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(Unknown 
> Source)
> at 
> com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(Unknown 
> Source)
> at CBPToFO.template$dot$0()
> at CBPToFO.applyTemplates()
> at CBPToFO.applyTemplates()
> at CBPToFO.transform()
> at 
> com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(Unknown 
> Source)
> at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown 
> Source)
> at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown 
> Source)
> at Test.main(Test.java:50)
> FEHLER: 'java.lang.String cannot be cast to 
> org.apache.fop.pdf.PDFObject'
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> org.apache.fop.pdf.PDFObject
> 
> 
> 
> *2)
> ----------
> SCHWERWIEGEND: Error while processing image: t:\__Oli\000\iphone.tif 
> (image/tiff)
> org.apache.xmlgraphics.image.loader.ImageException: Cannot load image 
> (no suitable loader/converter combination available) for 
> t:\__Oli\000\iphone.tif (image/tiff)
> at 
> org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:248)
> at 
> org.apache.fop.render.pdf.PDFRenderer.putImage(PDFRenderer.java:1733)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderImage(PDFRenderer.java:1679)
> at 
> org.apache.fop.render.AbstractRenderer.renderViewport(AbstractRenderer.java:734)
> at 
> org.apache.fop.render.AbstractPathOrientedRenderer.renderViewport(AbstractPathOrientedRenderer.java:557)
> at 
> org.apache.fop.render.AbstractRenderer.renderInlineArea(AbstractRenderer.java:617)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderInlineArea(PDFRenderer.java:1345)
> at 
> org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.java:592)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderLineArea(PDFRenderer.java:1336)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:529)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:564)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderBlock(PDFRenderer.java:1329)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:519)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:564)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderBlock(PDFRenderer.java:1329)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:519)
> at 
> org.apache.fop.render.AbstractPathOrientedRenderer.renderBlockViewport(AbstractPathOrientedRenderer.java:478)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:546)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderBlock(PDFRenderer.java:1329)
> at 
> org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:519)
> at 
> org.apache.fop.render.AbstractRenderer.renderFlow(AbstractRenderer.java:424)
> at 
> org.apache.fop.render.AbstractRenderer.renderMainReference(AbstractRenderer.java:403)
> at 
> org.apache.fop.render.AbstractRenderer.renderBodyRegion(AbstractRenderer.java:337)
> at 
> org.apache.fop.render.AbstractRenderer.renderRegionViewport(AbstractRenderer.java:282)
> at 
> org.apache.fop.render.AbstractRenderer.renderPageAreas(AbstractRenderer.java:255)
> at 
> org.apache.fop.render.AbstractRenderer.renderPage(AbstractRenderer.java:229)
> at 
> org.apache.fop.render.pdf.PDFRenderer.renderPage(PDFRenderer.java:801)
> at 
> org.apache.fop.area.RenderPagesModel.addPage(RenderPagesModel.java:113)
> at 
> org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage(AbstractPageSequenceLayoutManager.java:312)
> at 
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequenceLayoutManager.java:167)
> at 
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:108)
> at 
> org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:234)
> at 
> org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:123)
> at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:340)
> at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169)
> at 
> com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(Unknown 
> Source)
> at 
> com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(Unknown 
> Source)
> at CBPToFO.template$dot$0()
> at CBPToFO.applyTemplates()
> at CBPToFO.applyTemplates()
> at CBPToFO.transform()
> at 
> com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(Unknown 
> Source)
> at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown 
> Source)
> at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown 
> Source)
> at Test.main(Test.java:50) 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




Jeremias Maerki


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


Mime
View raw message