Hello,

I wanted to create a PDF file from some XML with FOP.  The PDF document was
OK and Acrobat reader showed it nicely.

Then I wanted to add some javascript to it in order to print it on reader
startup.  So I tried iText.
Unfortunately I get this error :

    [junit] [Fatal Error] :1:63: The prefix "x" for element "x:xmpmeta" is
not bound.
    [junit] ExceptionConverter: org.xml.sax.SAXParseException: The prefix
"x" for element "x:xmpmeta" is not bound.
    [junit]     at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    [junit]     at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
Source)
    [junit]     at
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
    [junit]     at com.lowagie.text.xml.xmp.XmpReader.<init>(Unknown Source)
    [junit]     at com.lowagie.text.pdf.PdfStamperImp.close(Unknown Source)
    [junit]     at com.lowagie.text.pdf.PdfStamper.close(Unknown Source)
    ...

Here is the code where the error occurs :

...
PdfReader reader = new PdfReader(((ByteArrayOutputStream)
os).toByteArray()); // os contains FOP output
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfStamper stamper = new PdfStamper(reader, baos);
stamper.addJavaScript("this.print(false);"); // javascript for printing
baos.close();
stamper.close(); // here comes the exception !!!
pdfOs.close();
...

What's strange is that there is no x:xmpmeta tag in FOP os.

So my questions are : where does this tag come from ?  why isn't it valid ?
how can I fix this ?

Regards,

-- 
Stéphane Vilboux



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to