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 Fri, 12 Sep 2008 06:31:37 GMT
I'm glad I could help. Removing the filterList resets the various
filters to their defaults which are well chosen. XMP streams won't be
compressed in this case. The filterList is essentially there for FOP
developers so we can disable compression when we debug PDF output.
Advanced users can tweak PDF generation (add base64 encoding and such)
if they know what they do. Normal users shouldn't need to care about
that.

On 11.09.2008 22:20:44 Anil Pinto wrote:
> Jeremias,
> 
> It worked !! Thank you very much.
> 
> Just curious, removing the  <filterList> element in it's entirety should not
> cause any noticeable effects to the PDF creation process and other user
> configuration settings, right ? My ignorance wrt XMP is just forcing me to
> verify the effect of the change.
> 
> For what it's worth, I am glad that the fix was quite simple :-)
> 
> Thank you,
> Anil Pinto.
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> Sent: Thursday, September 11, 2008 12:58 PM
> To: fop-users@xmlgraphics.apache.org
> Cc: apinto@lobotec.com
> Subject: Re: FOP 0.95 and iText for watermarks throws "Content is not
> allowed prolog" when referencing the FOP configuration file
> 
> 
> Hmm, I guess I'll have to take a closer look at this when I have more
> time. I seems that
> 
>       <filterList>
>         <!-- provides compression using zlib flate (default is on) -->
>         <value>flate</value>
> 
>         <!-- encodes binary data into printable ascii characters (default
> off)
>              This provides about a 4:5 expansion of data size -->
>         <!-- <value>ascii-85</value> -->
> 
>         <!-- encodes binary data with hex representation (default off)
>              This filter is not recommended as it doubles the data size -->
>         <!-- <value>ascii-hex</value> -->
>       </filterList>
> 
> also activates the "flate" filter for the XMP stream but that stream
> must never be compressed. Anil, please just remove the entire
> "filterList" element from the configuration file. After that it should
> all work. The defaults will still make sure that the PDF is compressed.
> 
> HTH
> 
> On 11.09.2008 21:12:51 Anil Pinto wrote:
> > Jeremias,
> >
> > Here are the PDF files and other resources in a .zip that I hope shed
> light on the situation.
> >
> > The image file is a snapshot of the diff tool showing the section that I
> mentioned in my previous email. Note that when I copy the contents of the
> left and overwrite the contents on the right and save the PDF, the water
> mark is now created by iText without complains.
> >
> > Hope this help and I really appreciate you taking the time to help further
> investigate this problem. Let me know if there is any more information you
> would like.
> >
> > Thanks,
> > Anil Pinto.
> >
> > -----Original Message-----
> > From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> > Sent: Thursday, September 11, 2008 2:49 AM
> > To: fop-users@xmlgraphics.apache.org
> > Cc: apinto@lobotec.com
> > Subject: Re: FOP 0.95 and iText for watermarks throws "Content is not
> > allowed prolog" when referencing the FOP configuration file
> >
> >
> > 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:26
> 4)
> > >         at
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBu
> ilderImpl.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 text.
> > >
> > > 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 config).
> > >
> > > 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
> 
> 
> 
> 
> Jeremias Maerki
> 
> 



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