Ch.1: PDF
How PDF came about (Warnock's Camelot memo) and how a PDF file stores pages, text, fonts and structure. Written from the PDF Reference 1.7, linked on every card.
38 flashcards · Computer Science · by lakesare
Part of Public › PDF vs EPUB: file formats explained · 3 courses
[What a PDF is] What is a PDF file, in one sentence?
A file that describes pages so that they look the same on any computer, in any program and on any printer. PDF stands for Portable Document Format. Adobe's PDF Reference: the format is independent of the software, hardware and operating system that made the document, and of the screen or printer that shows it.Source: PDF Reference 1.7, Chapter 2
[What a PDF is] A web page re-breaks its lines when you make the window narrower. Who decides where each line of a PDF ends?
The program that made the PDF, once, when it wrote the file. The PDF stores the finished layout. The PDF Reference: a page's appearance is fully specified, and all layout decisions were already made by the program that created the file.Example: a Word document saved as PDF keeps the line breaks Word chose for its page width, also when opened on a phone.Source: PDF Reference 1.7, Chapter 2
[What a PDF is] Many programs cannot write PDF files themselves. How do they still produce a PDF?
You "print" to a PDF printer: a printer driver that writes a PDF file instead of sending the page to paper. The PDF Reference describes the Adobe PDF printer on Windows and Mac OS: it takes the drawing commands that a program sends to a printer and writes them into a PDF file.The resulting file can be viewed and printed on any system, even a different one from where it was made.Source: PDF Reference 1.7, §2.3
[What a PDF is] Does a page in a PDF have a fixed size?
Yes: every page has a width and a height, measured in units of 1/72 inch. 1/72 inch is about one point, the unit of the printing industry (the PDF Reference adds that there is no universal definition of a point).Example: a page of 612 by 792 units is 612/72=8.5612/72 = 8.5612/72=8.5 by 792/72=11792/72 = 11792/72=11 inches, the US Letter paper size.Source: PDF Reference 1.7, §4.2.1
[What a PDF is] How large can a PDF page be?
In Acrobat 5 and later: from about 0.04 by 0.04 inch up to 200 by 200 inches. With a larger unit (PDF 1.6, Acrobat 7): up to 15,000,000 inches. Example: 15,000,000 inches =15,000,000⋅2.54= 15{,}000{,}000 \cdot 2.54=15,000,000⋅2.54 cm =381= 381=381 km.Source: PDF Reference 1.7, Appendix H, note 177
[Why PDF was invented] Who started PDF, and with which document?
John Warnock of Adobe, with his 1991 memo "The Camelot Project". The PDF Reference dates the origins of PDF and Acrobat to early 1990. The first PDF specification was published in 1993, together with the first Acrobat programs.Source: Warnock, "The Camelot Project" (1991)Source: PDF Reference 1.7, Preface
[Why PDF was invented] Which problem did Warnock's memo "The Camelot Project" (1991) set out to solve?
Programs could print to many printers, but there was no universal way to send printed pages electronically and view them on another computer. Sending just the text loses the fonts, the layout and the pictures. The memo wanted documents that can be viewed on any screen and printed on any printer.Source: Warnock, "The Camelot Project" (1991)
[Why PDF was invented] Fax machines could already send pages in 1991. Why did Warnock's Camelot memo find fax not good enough?
Poor quality, a lot of data to transmit, and results that depend on the fax device. The memo describes fax as sending images around to produce paper at the other end, not documents to view on a computer.Source: Warnock, "The Camelot Project" (1991)
[Why PDF was invented] Why did a document often look different on another computer in 1991?
The other computer often lacked the document's fonts and substituted other fonts. The memo calls the font substitution schemes of the time complex. The PDF Reference explains the damage: a substitute font has different letter shapes and widths, so lines of text can run into the margins or overlap pictures.Source: Warnock, "The Camelot Project" (1991)Source: PDF Reference 1.7, §2.2.3
[Why PDF was invented] What is PostScript, the Adobe technology that Warnock's Camelot memo built on?
A language for describing printed pages: a program sends a PostScript file to the printer, and the printer follows its instructions to draw the page. In 1991 over 100 printer models understood PostScript, and over 4000 programs printed through PostScript.Example: "1 0 moveto 0.809 0.588 lineto" means: put the pen at the point (1, 0) and draw a line to the point (0.809, 0.588).Source: Warnock, "The Camelot Project" (1991)
[Why PDF was invented] PostScript is Adobe's language for describing printed pages. If printers understood PostScript, why could people in 1991 not simply e-mail PostScript files and view them on screen?
Viewing and printing PostScript needed powerful computers and PostScript printers, which most people did not have. Warnock wanted documents to work on the machines people had: PCs with 640K of memory, Macintoshes, mainframes and workstations.Source: Warnock, "The Camelot Project" (1991)
[Why PDF was invented] What was the plan of Warnock's Camelot memo (1991), in plain words?
Convert a document once into a simpler file with the fonts included; then a small viewer program shows that file on any computer. Warnock called the simpler format "Interchange PostScript": only the drawing commands of PostScript (Adobe's language for describing printed pages).The other option, making full PostScript small and fast enough for small machines, had been tried and was "extremely difficult", the memo says.Source: Warnock, "The Camelot Project" (1991)
[Why PDF was invented] Warnock's Camelot memo proposed a format with only a small part of PostScript's commands. With which comparison did he argue that a small part is enough?
English: nobody knows every English word, yet a small part of the words lets people communicate. The memo admits that some pictures possible in full PostScript could not be expressed, but expected such cases to be extremely rare.Source: Warnock, "The Camelot Project" (1991)
[Why PDF was invented] Which uses of electronic documents did Warnock's 1991 Camelot memo imagine?
E-mail Newspapers, magazine articles and technical manuals sent by e-mail, viewed on any machine and printed locally. CD-ROMs Encyclopedias, atlases, military maps and service manuals shipped on CD-ROM together with a viewer. Search Find all documents that contain a word or phrase, and show the phrase in its place in the document. Archives Whole libraries stored electronically, printable at any location. The memo expected this to save millions of dollars in document inventory costs.Source: Warn…
[Why PDF was invented] Did Warnock's 1991 Camelot memo already ask for zooming into documents on screen?
Yes: users must be able to magnify parts of complex maps, so that small details are readable even on low-resolution screens. For this the memo required the format to be device independent: the same file prints in colour or black and white, at low or high resolution, and shows at any magnification.Source: Warnock, "The Camelot Project" (1991)
[Why PDF was invented] How widespread had PDF become by 2004?
Over 500 million copies of the free Adobe Reader had been distributed, and PDF was the standard for exchanging documents electronically. PDF had also become the industry standard for handing material to printing companies.From the preface of the PDF Reference, signed by Chuck Geschke and John Warnock in November 2004.Source: PDF Reference 1.7, Preface
[Why PDF was invented] Warnock's Camelot memo planned that every file in the new format would also be a valid PostScript file (PostScript: Adobe's language for printed pages). Did PDF turn out that way?
No: a PDF generally cannot be sent directly to a PostScript printer. PDF is not a programming language: unlike PostScript, PDF has no procedures, variables or loops. That makes PDF simpler and more predictable to display.PDF also adds things PostScript lacks, such as links and a fixed file structure that lets a viewer jump to any page.Source: PDF Reference 1.7, §2.4
[Why PDF was invented] The PDF copy of Warnock's 1991 Camelot memo that is online today: which program made it, and when?
Acrobat PDFWriter 2.0 for Macintosh, in 1995, from a Microsoft Word file. So the memo that started PDF was turned into a PDF four years after it was written.Seen with the tool pdfinfo on the memo's PDF: Creator "Microsoft Word", Producer "Acrobat PDFWriter 2.0 for Macintosh", created 5 May 1995.
[What PDF means for you] Why is PDF a good format for printing?
The file describes every page completely, with the fonts and the exact position of everything, so different printers produce the same page. By 2004 PDF was the industry standard for handing material to printing companies.Source: PDF Reference 1.7, Preface
[What PDF means for you] Why are many official forms PDF files?
A PDF can contain fields to fill in: text boxes, check boxes, radio buttons, choice lists and signature fields (since PDF 1.2). The form looks exactly like the paper version, and the filled-in values can be exported to other programs.Source: PDF Reference 1.7, §8.6
[What PDF means for you] Can you open a PDF that uses a font you do not have installed?
Yes, usually: the font can be stored inside the PDF file. 14 standard fonts need not be stored: Courier, Helvetica and Times in four styles each, plus Symbol and ZapfDingbats. Every PDF viewer must provide them, or fonts with the same letter widths.Example: Epp's textbook PDF stores most of its fonts inside the file, but uses Courier without storing Courier.Source: PDF Reference 1.7, §2.2.3
[What PDF means for you] A PDF names a font that is neither stored in the file nor installed on your computer. What does the viewer do?
It uses a similar font instead: the letters look different, but each letter still stands at its exact position. The PDF records the measurements of each font it uses, so the viewer can pick or adjust a replacement font.Source: PDF Reference 1.7, §2.2.3
[What PDF means for you] Why does text copied from a PDF often come out with broken lines, or with words from different places run together?
A PDF stores letters at positions, not words, lines or paragraphs; the copying program has to guess them from the positions. The PDF Reference gives an example of the problem: the first words of a second article on the same page must not be run together with the first article. Only the optional tags of a "Tagged PDF" tell a program where one ends.Source: PDF Reference 1.7, §10.7.1
[What PDF means for you] Why can a digitally signed PDF still be edited without breaking the signature?
Edits are added at the end of the file; the signed bytes stay unchanged. Any change to the signed bytes makes the signature invalid. Removing the added edits gives back the exact original file, so the signature can still be checked.This also makes saving fast: the time to save is proportional to the size of the change, not to the size of the file.Source: PDF Reference 1.7, §2.2.6–2.2.7
[A look inside a PDF file] Inside the file, how does a PDF page describe its text?
As text instructions: choose a font and size, go to a position, paint these letters. Positions are in units of 1/72 inch, and the point (0, 0) is usually the bottom-left corner of the page.Source: PDF Reference 1.7, §5.1.1
[A look inside a PDF file] How small can a complete PDF file be that shows one page with the word "Hello"?
586 bytes, in a file written for this course. What the inside of a PDF literally looks like. The parts: a version line, the objects (catalog, page list, page, text instructions, font), a table of where each object starts in the file, and a final part that points to that table.Source: PDF Reference 1.7, §3.4
[A look inside a PDF file] Where does a PDF viewer start reading a PDF file?
At the end: there it finds the table of where each part of the file starts. With this table, the time to find a page is nearly independent of the length of the document, so a viewer can open page 900 of a 1000-page PDF without reading the first 899.The table is at the end because a program writing the file in one go knows all the positions only when it has finished.Source: PDF Reference 1.7, §2.2.5
[A look inside a PDF file] In which order does a PDF store the pieces of text on a page?
In any order: the page looks the same whatever order the pieces are stored in. The PDF Reference only notes that copying text out works better if the pieces are long and in natural reading order.Source: PDF Reference 1.7, §5.3.2
[A look inside a PDF file] Does a PDF store the spaces between words?
Not necessarily: Epp's textbook PDF stores no space characters at all; each gap is a number that moves the next word to the right. The Times-Roman font stored inside Epp's file has no space character at all. Programs that copy text out insert a space wherever two letters are far enough apart, as the pdfminer.six documentation describes.Seen when extracting a real textbook: Epp, "Discrete Mathematics with Applications" (PDF made with InDesign and Acrobat Distiller, 2010).Source: PDF Reference 1.…
[A look inside a PDF file] Can text that was deleted from a PDF still be inside the file?
Yes: an edit saved as an addition at the end of the file leaves the old text in the file, only no longer shown. Example: a 586-byte PDF that says "Hello", edited to say "Hello world". The tool pdftotext prints "Hello world", but the bytes "(Hello)" are still in the file.Source: PDF Reference 1.7, §3.4.5
[A look inside a PDF file] When a PDF stores a font inside the file, does it store the whole font?
Often not: it can store only the letters the document uses, a "font subset" (since PDF 1.1). Warnock's 1991 memo already planned this, so that a file could be sent anywhere without worrying whether the receiver has the fonts.Example: Epp's textbook PDF contains four separate subsets of Times-Roman, named like GDOFPI+Times-Roman: six arbitrary capital letters, a plus sign, the font name.Source: Warnock, "The Camelot Project" (1991)Source: PDF Reference 1.7, §5.5.3
[A look inside a PDF file] Why can a PDF show a letter correctly on screen, while copying it gives a wrong or odd character?
The file says which shape to paint, not necessarily which letter the shape is; that link exists only if the PDF includes a translation table. Without such a table (called a ToUnicode map) or a standard encoding, the PDF Reference says there is "no way to determine" what the code means.Example: Epp's PDF paints "fi" as one joined shape and translates it to the single character "fi" (U+FB01), so copied text contains "Quantified", not the letters f and i.Seen when extracting a real textbook: Epp, "D…
[Tagged PDF and screen readers] Why do screen readers (programs that read a document aloud) often struggle with PDFs?
An ordinary PDF records where letters are painted, not what is a heading, a paragraph or a page number, nor the order to read them in. The PDF Reference: to read a document aloud properly, a program must find its logical order independently of its appearance, and only the tags of a Tagged PDF provide that order.Source: PDF Reference 1.7, §10.8
[Tagged PDF and screen readers] What is a tagged PDF (PDF 1.4)?
A PDF that also stores the document's structure: headings, paragraphs, lists, tables and figures, in reading order, linked to the text on the pages. The tags are invisible on the page. Their uses, by the PDF Reference: copying text, reflowing text to another page size, searching, converting to formats such as HTML, and access for users with visual impairments. What tags literally look like inside a file: a tree of headings (H1), paragraphs (P) and figures, pointing to numbered pieces of the pag…
[Tagged PDF and screen readers] Can a PDF re-break its lines to fit a phone screen?
Only with help from tags: automatic reflow to a different page size is one of the purposes of Tagged PDF. An untagged PDF says nothing about which pieces of text belong together or in which order to read them.Example: the tool pdfinfo reports "Tagged: no" for Epp's textbook PDF and for the PDF of Warnock's memo.Source: PDF Reference 1.7, §10.7
[Tagged PDF and screen readers] In a tagged PDF, what happens to page numbers and running heads?
They are marked as "artifacts": material added by the layout, not by the author, which a screen reader can skip. Other artifacts: footnote separator lines, cut marks, background pictures.Source: PDF Reference 1.7, §10.7.1
[Tagged PDF and screen readers] How can a screen reader read out a picture or a formula in a tagged PDF?
From an "alternate description": a text that the PDF attaches to the picture or formula. Example: a star symbol in the text can carry the description "six-point star".Since PDF 1.7 a table can also carry a summary of its purpose and structure, so a listener understands the table without hearing every cell.Source: PDF Reference 1.7, §10.8.2
[Tagged PDF and screen readers] How does a screen reader know whether to pronounce the text of a PDF as English or as Spanish?
From the "Lang" entry (PDF 1.4), which gives the language of the whole document or of single parts. Example: a mostly English document can mark one quoted sentence as Spanish.Source: PDF Reference 1.7, §10.8.1