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: FOP 0.95 and iText for watermarks throws "Content is not allowed prolog" when referencing the FOP configuration file
Date Thu, 11 Sep 2008 09:49:04 GMT
When I implemented XMP functionality I've verified it with various tools.
The stacktrace shows that iText has a problem parsing the XMP packet in
the PDF. I'd ask the iText people first why they can't parse the XMP
packet. Maybe there's something wrong with their setting up of the XML
parser for the metadata stream. Without access to the two PDFs you
produced I have no idea why it works one time but not the other.

If you can open the PDF in Acrobat Reader and look at the metadata
("Additional Metadata..." button) then iText probably needs to improve
their code.

On 11.09.2008 02:30:26 Anil Pinto wrote:
> Hello,
> I am in the process of evaluating iText for it's watermark capabilities on PDF.
> I have been using FOP 0.95 since it's release for PDF creation. I have used previous
versions of FOP but not with iText (2.1.3).
> I was able to get the watermark to appear without problems when running iText on a PDF
created by FOP 0.95 from the command prompt. When I tried the same from a PDF created using
a standalone Java problem that used the API FOP  I encountered the error 
> Exception in thread "main" ExceptionConverter: org.xml.sax.SAXParseException: Content
is not allowed in prolog.
>         at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
>         at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
>         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
>         at com.lowagie.text.xml.xmp.XmpReader.<init>(Unknown Source)
>         at com.lowagie.text.pdf.PdfStamperImp.close(Unknown Source)
>         at com.lowagie.text.pdf.PdfStamper.close(Unknown Source)
>         at temp.ITextTest.watermark(ITextTest.java:200)
>         at temp.ITextTest.applyWaterMark(ITextTest.java:128)
>         at temp.ITextTest.main(ITextTest.java:218)
> I initially thought it was something to do with (maybe) different parser references in
the classpath. But was then able to replicate the problem with the same jars on the classpath.
> I am using JDK 1.5.0_06 with the necessary jars provided by fop.
> The cause of the problem seemed to be when I used the user configuration reference to
configure the fop. I was able to recreate the problem from the command line now while referencing
the configuration file (fop.xconf). Without the config file iText gladly adds the watermark
> On comparing the 2 pdfs in a comparison tool, I saw the following code/tags in the pdf
that works (no config reference) that did not exist in the pdf that did not work (referenced
> stream
> <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
> <x:xmpmeta xmlns:x="adobe:ns:meta/">
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
> <pdf:PDFVersion>1.4</pdf:PDFVersion>
> <pdf:Producer>Apache FOP Version 0.95</pdf:Producer>
> </rdf:Description>
> <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
> <xmp:CreateDate>2008-09-10T16:53:50-07:00</xmp:CreateDate>
> </rdf:Description>
> <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
> <dc:date>
> <rdf:Seq>
> <rdf:li>2008-09-10T16:53:50-07:00</rdf:li>
> </rdf:Seq>
> </dc:date>
> </rdf:Description>
> </rdf:RDF>
> </x:xmpmeta>
> <?xpacket end="r"?>
> endstream
> On overwriting this information to the other PDF (overwriting binary contents between
stream and endstream), iText stops complaining and creates the watermark.
> I am not sure why the configuration file reference is introducing some content that iText
does not like, but I need to reference the configuration file. 
> Any help towards getting this problem resolved is greatly appreciated.
> Thanks,
> Anil Pinto.

Jeremias Maerki

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

View raw message