Comment

Comment by mrb

Fun experiment alexwlchan! Two small mistakes in your post: you write "15,000,000,000.00 in" and "that the size of a page is 15 billion inches", but it should be 15 million.

You said you had difficulty formatting text. Here is a "hello world" pdf that just has these two words on a page: copy and paste this text (stripping leading spaces on each line) and save it in a .pdf file. Basically in order to write text you have to define a font (object 5) and then a stream with a Tf command to use the font, a Td command to position the text, and a Tj command to write it.

    %PDF-1.2
    1 0 obj
    <<
     /Type /Catalog
     /Pages 2 0 R
    >>
    endobj
    2 0 obj
    <<
     /Type /Pages
     /Kids [ 3 0 R ]
     /Count 1
     /MediaBox
     [ 0 0 612 792 ]
    >>
    endobj
    3 0 obj
    <<
     /Type /Page
     /Parent 2 0 R
     /Resources 4 0 R
     /Contents 6 0 R
    >>
    endobj
    4 0 obj
    <<
     /ProcSet[/PDF/Text]
     /Font <<
      /F1 5 0 R
     >>
    >>
    endobj
    5 0 obj
    <<
     /Type /Font
     /Subtype /Type1
     /BaseFont /Times-Roman
    >>
    endobj
    6 0 obj
    <<
     /Length 52
    >>
    stream
    BT
    /F1 48 Tf
    185 400 Td
    (Hello World)Tj
    ET
    endstream
    endobj
    trailer
    <<
     /Root 1 0 R
    >>
parent mrb 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton