Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:37:22+00:00 2026-06-05T06:37:22+00:00

I just found the post Adobe Forums: Simple Text String Example in specification broken.

  • 0

I just found the post Adobe Forums: Simple Text String Example in specification broken., so I got interested in finding plain-text source code PDF examples.

So, through that post, I eventually found:

  • The webpage PDF Reference and Adobe Extensions to the PDF Specification | Adobe Developer Connection ; which contains:
    • The PDF Document Management – Portable Document Format – Part 1: PDF 1.7, First Edition (PDF32000_2008.pdf)

The PDF 1.7 spec has on page 699 appendix “_Annex H (informative) Example PDF files”; and from there, I wanted to try “H.3 Simple Text String Example” (the “classic Hello World”).

So I tried to save this as hello.pdf (_except note when you copy from the PDF32000_2008.pdf, you may get “%PDF-1. 4” – that is, a space inserted after 1., which must be removed_) :

%PDF-1.4
1 0 obj
  << /Type /Catalog
      /Outlines 2 0 R
      /Pages 3 0 R
  >>
endobj

2 0 obj
  << /Type /Outlines
      /Count 0
  >>
endobj

3 0 obj
  << /Type /Pages
      /Kids [ 4 0 R ]
      /Count 1
  >>
endobj

4 0 obj
  << /Type /Page
      /Parent 3 0 R
      /MediaBox [ 0 0 612 792 ]
      /Contents 5 0 R
      /Resources << /ProcSet 6 0 R
      /Font << /F1 7 0 R >>
  >>
>>
endobj

5 0 obj
  << /Length 73 >>
stream
  BT
    /F1 24 Tf
    100 100 Td
    ( Hello World ) Tj
  ET
endstream
endobj

… and I’m trying to open it:

evince hello.pdf

… however, evince cannot open it: “Unable to open document / PDF document is damaged”; and also:

Error: PDF file is damaged - attempting to reconstruct xref table...
Error: Couldn't find trailer dictionary
Error: Couldn't read xref table

I also check with qpdf:

$ qpdf --check hello.pdf
WARNING: hello.pdf: file is damaged
WARNING: hello.pdf: can't find startxref
WARNING: hello.pdf: Attempting to reconstruct cross-reference table
hello.pdf: unable to find trailer dictionary while recovering damaged file

Where am I going wrong with this?

Many thanks in advance for any answers,
Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:37:24+00:00Added an answer on June 5, 2026 at 6:37 am

    You should append a (syntactically correct) xref and trailer section to the end of the file. That means: each object in your PDF needs one line in the xref table, even if the byte offset isn’t correctly stated. Then Ghostscript, pdftk or qpdf can re-establish a correct xref and render the file:

    [...]
    endobj
    xref 
    0 8 
    0000000000 65535 f 
    0000000010 00000 n 
    0000000020 00000 n 
    0000000030 00000 n 
    0000000040 00000 n 
    0000000050 00000 n 
    0000000060 00000 n 
    0000000070 00000 n 
    trailer 
    <</Size 8/Root 1 0 R>> 
    startxref 
    555 
    %%EOF 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a post that provides an example for a link which opens just
I just found this post , we have almost the same scenario with the
EDIT: I just found my problem after writing this long post explaining every little
I was just reading this post When is IHttpModule.Dispose method called? I found this
Just found out what Ajax is, and I want to build a simple Ajax/Jquery
I just found CompletionService in this blog post . However, this does't really showcases
Just found out that the video output of the iPad is not a system
I just found out about ie7-js ; IE7 is a JavaScript library to make
I just found out about superfish and currently using it on an asp.net. The
I just found Dean Edwards javascript packer here: http://dean.edwards.name/packer/ It has a couple of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.