Live data from Hacker News

Making a PDF that's larger than Germany

alexwlchan.net

11–20 of 156 posts

Re: Making a PDF that's larger than Germany

#11
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
    >
    endobj
    2 0 obj
    >
    endobj
    3 0 obj
    >
    endobj
    4 0 obj
    >
    >>
    endobj
    5 0 obj
    >
    endobj
    6 0 obj
    >
    stream
    BT
    /F1 48 Tf
    185 400 Td
    (Hello World)Tj
    ET
    endstream
    endobj
    trailer
    >

Re: Making a PDF that's larger than Germany

#12
post #3

Coincidentally, I just finished watching a video that explored the same topic of massive and unique PDF files: https://www.youtube.com/watch?v=ZvVNRRQjDh8

yeah, I went here to post it as well

not every time one can see a whole game integrated into a PDF!

Re: Making a PDF that's larger than Germany

#13
post #11

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 ha…

Is the xref at the end of a PDF required or not? Seems like it is in the spec.

Re: Making a PDF that's larger than Germany

#15

While the Germany PDF actually scrolls pretty quickly at 100% zoom (makes one realize just how much text is read in a day), the Universe one is pretty fun, Firefox's PDF reader at 100% zoom obviously doesn't budge the scrollbar at all.

Hackaday soon: Synchronizing a treadmill to a pdf the size of Germany.

Obligatory?: The pdf is not the territory.

Re: Making a PDF that's larger than Germany

#19
post #11

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 ha…

Is the xref at the end of a PDF required or not? Seems like it is in the spec.

It is required according to the standard. But in practice most PDF viewers don't care. They may complain the PDF is "damaged" or "no valid xref was found", but they will render it perfectly fine.

Re: Making a PDF that's larger than Germany

#20
post #11

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 ha…

Is the xref at the end of a PDF required or not? Seems like it is in the spec.

By the spec, yes. Some PDF readers will parse it anyway, some will not. In my experience depending on the renderer the xref table can be varying degrees of malformed before things go wrong. Edge's old PDF reader (the one before Acrobat and after PDFium) for example seemed to tolerate just about anything, falling back to the latest version of objects if the xref table was broken. There's also other mistakes you can make, like for example, the xref table requires carriage returns (each entry in the table is supposed to be an exact number of bytes) but some PDF readers will still interpret the xref table even if the carriage returns are missing.
Post reply on HN