jlettvin
jlettvin

Reputation: 1183

Why is this PDF metadata not valid?

I need help understanding how to make this document compliant. Any other advice would be wonderful.

I have been digging through the various examples, tutorials, and official documents; and I think I am close to the solution.

The "hello world" text appears in the MediaBox, but metadata is inaccessible.

The rules seem clear, but things like Title do not appear for pdfinfo or File>Properties.

%PDF-1.1
¥±˫

% Metadata (referenced by trailer /Info)
0 0 obj
  /Title        (simple 80x25 text PDF)
  /Subject      (test PDF)
  /Producer     (simple.80x25.text.PDF.py)
  /Creator      (gvim)
  /Keywords     (PDF test)
  /CreationDate (D:2018021300000-05'00')
endobj

% Content (referenced by trailer /Root)
1 0 obj
  <<
    /Type /Catalog /Pages 2 0 R
  >>
endobj

% Text display box (referenced by 1 0 obj)
2 0 obj
  << /Type /Pages /Kids [3 0 R] /Count 1 /MediaBox [0 0 480 300] >>
endobj

% Text font (referenced by 2 0 obj)
3 0 obj
  << /Type /Page /Parent 2 0 R /Resources
    << /Font
      << /F1
        << /Type /Font /Subtype /Type1 /BaseFont /Courier >>
      >>
    >>
    /Contents 4 0 R
  >>
endobj

% Text to be displayed in the box (referenced by 3 0 obj)
4 0 obj
  << /Length 5 0 R >>
stream
  BT
    /F1 10 Tf 12 TL 0 290 Td
    (hello world) Tj
  ET
endstream
endobj

% Main (collect resources for reference from entrypoint)
trailer
  << /Root 1 0 R /Info 0 0 R /Size 6 >>

startxref 0
%%EOF

Upvotes: 0

Views: 1157

Answers (1)

iPDFdev
iPDFdev

Reputation: 5834

Start with 1 for document information and put the keys in a dictionary object, your sample is missing the << and >>:

% Metadata (referenced by trailer /Info)

1 0 obj
<<
  /Title        (simple 80x25 text PDF)
  /Subject      (test PDF)
  /Producer     (simple.80x25.text.PDF.py)
  /Creator      (gvim)
  /Keywords     (PDF test)
  /CreationDate (D:2018021300000-05'00')
>>
endobj

Upvotes: 1

Related Questions