Bug 39070 - FOP Produced PDFs contain invalid Info Dict entry
Summary: FOP Produced PDFs contain invalid Info Dict entry
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: all
Hardware: Other other
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-23 02:09 UTC by John Yonosh
Modified: 2012-04-01 06:35 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Yonosh 2006-03-23 02:09:43 UTC
Adding "/Type /Info" as an info dictionary entry produces an entry in the info
dict whose value is a name(pdf data type). This is invalid (as names are not
allows as values within the info dict), and causes some PDF Libraries the throw
errors when reading the information. 

In my case i have an application using the Adobe PDF Library 7.0 that throws an
error("Could not create internal representation of XMP metadata") when calling
PDDocGetXAPMetadataProperty. When i remove the invalid entry from the info dict,
everything works properly.

I did look in the svn repository and it appears that the Trunk code should still
have the same issue.

The following is what i updated in 0.20.5 to work around the issue

From org.apache.fop.pdf.PDFInfo

    public byte[] toPDF() {
        String p = this.number + " " + this.generation
                   + " obj\n<< /Type /Info\n/Producer (" + this.producer
                   + ") >>\nendobj\n";
        try {
            return p.getBytes(PDFDocument.ENCODING);
        } catch (UnsupportedEncodingException ue) {
            return p.getBytes();
        }       
    }

should be changed to(just removing the "/Type /Info")
    public byte[] toPDF() {
        String p = this.number + " " + this.generation
                   + " obj\n<< \n/Producer (" + this.producer
                   + ") >>\nendobj\n";
        try {
            return p.getBytes(PDFDocument.ENCODING);
        } catch (UnsupportedEncodingException ue) {
            return p.getBytes();
        }       
    }

Thanks,
john
Comment 1 Jeremias Maerki 2006-03-23 07:59:25 UTC
Bug fixed in FOP Trunk: http://svn.apache.org/viewcvs?rev=388092&view=rev
Thank you, John! You are right, of course. Surprising this bug went undetected
for so long.
Comment 2 Glenn Adams 2012-04-01 06:35:22 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed