Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] A small improvement to Support PDF/A

Seung Hyun Park

2007-07-02

Replies:

Hello.
 
I'm very pleased that iText have started to support PDF/A.
 
By the way, I found a small point to improve compatibility to PDF/A.
 
PDF/A forces that the info dictionary of PDF have to match with the XMP metadata embedded to PDF.
 
But, the subject of info dictionary of PDF must match with the dc:description of XMP metadata.
 
 
If you handle info dictionary directly, you will have to change the constructor of XmpWriter that has a stream and a hashtable for input in XmpWriter class,
 
you can add a line to match subject of hashtable with dc:description of XMP metadata as followings; ( following codes are for iTextSharp.)
 
         public XmpWriter(Stream os, Hashtable info) : this(os) {
            if (info != null) {
                DublinCoreSchema dc = new DublinCoreSchema();
                PdfSchema p = new PdfSchema();
                XmpBasicSchema basic = new XmpBasicSchema();
                String value;
                foreach (DictionaryEntry entry in info) {
                    String key = (String)entry.Key;
                    value = (String)entry.Value;
                    if (value == null)
                        continue;
                    if ("Title".Equals(key)) {
                        dc.AddTitle(value);
                    }
                    if ("Author".Equals(key)) {
                        dc.AddAuthor(value);
                    }
                    if ("Subject".Equals(key)) {
                       dc.AddSubject(value);
                       dc.AddDescription (value);      //add to comply with PDF/A-1
                    }
                    if ("Keywords".Equals(key)) {
                        p.AddKeywords(value);
 
                    ...
 
 

Best regards,

S. H. Park

 

P.S. I apologize for my short English skill.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.