Graphics Programs Reference
In-Depth Information
startxref
0
%%EOF
As it stands,
hello-broken.pdf
is not a valid PDF file, and even Adobe Reader (which
is fairly tolerant of malformed files) won't cope with it.
We can use the free
pdftk
tool to fix up the
hello-broken.pdf
file with the missing details,
writing the output to
hello.pdf
:
pdftk hello-broken.pdf output hello.pdf
pdftk
reads the file and its objects, and calculates the correct data for the missing or
incorrect sections we wrote, and produces the valid file shown in
Example 2-2
. Note
that the spacing and formatting of some of the syntax has been altered—each PDF
producer makes slightly different choices about this.
Example 2-2. The completed PDF file hello.pdf, fixed by pdftk
%PDF-1.0
%âãÏÓ
1 0 obj
<<
/Kids [2 0 R]
/Count 1
/Type /Pages
>>
endobj
2 0 obj
<<
/Rotate 0
/Parent 1 0 R
/Resources 3 0 R
/MediaBox [0 0 612 792]
/Contents [4 0 R]
/Type /Page
>>
endobj
3 0 obj
<<
/Font
<<
/F0
<<
/BaseFont /Times-Italic
/Subtype /Type1
/Type /Font
>>
>>
>>
endobj
4 0 obj
<<
/Length 65
>>