All 38 questions from the ends of the Learning pages, in reading order. Pick an answer and check it: every answer comes with the reason, and a wrong one links back to the page that covers it.
Foundations
The big picture
Q1. A PostScript file is a program you run to get pages. What is a PDF file instead?
Q2. How different is PDF 1.7 (ISO 32000-1) from PDF 1.4 at its core?
Q3. A PDF 1.3 reader opens a file that uses transparency. What happens?
Objects
Q4. Which of these is not a valid PDF number?
.5-31e53.14.5, is fine.Q5. A stream has
/Filter [/ASCII85Decode /FlateDecode]. In what order does a reader decode it?Q6. Why may a stream's
/Length be an indirect reference such as 7 0 R?/Length by scanning for endstream.File anatomy
Q7. What does each in-use entry of a classic cross-reference table store?
n (in use) or f (free). A reader seeks straight to the offset.Q8. Where does a reader start when it opens a PDF?
%PDF- headerstartxrefstartxref, in the last kilobyte or so, gives the offset of the last cross-reference section; the trailer after it gives /Root, the catalog.Q9. How does an incremental update change a file?
/Prev points to the old xrefThe document tree
Q10. How is the document tree laid out in the file?
N 0 R references/Root and follows references, using the cross-reference table to turn each one into a byte offset.Q11. Which of these page attributes is not inherited from a
/Pages node?/MediaBox/Rotate/Resources/Contents/Resources, /MediaBox, /CropBox and /Rotate. A page without one walks up its /Parent links until a node has it.Q12. A 1.3 file is edited with an incremental update that uses 1.4 features. Where does the new version number go?
%PDF- header/Version entry in the catalog/Info dictionarystartxref comment/Version overrides the header, so the file can be updated incrementally and existing signatures stay valid.Drawing a page
Content streams
Q13. In default user space, where is the origin and what is one unit?
/UserUnit to change the unit size.Q14. What does
0 0 1 RG set?0 0 1 is pure blue in DeviceRGB.Q15. An image is painted with
/Im0 Do. What decides its size on the page?/Width and /Height, read as points/MediaBox/BBoxcm first: 200 0 0 150 300 400 cm makes it 200 × 150 at (300, 400). /Width and /Height count samples, not points.Graphics state
Q16. Which of these is not saved and restored by
q and Q?TfBT … ET and is reset by every BT. The font is text state, which is part of the graphics state, so q and Q save it.Q17. A form XObject's content stream never sets a fill color. What color do its fills come out in?
Do/ResourcesDo saves the state as q would and the form inherits it, so it paints in the caller's color. Afterwards the state is restored, so nothing the form sets leaks out.Q18. Which of these can only be set through an ExtGState dictionary and
gs?w, fill color rg and friends, the font Tf. Overprint (/OP, /op), transparency, stroke adjustment and the device-dependent parameters have no operator of their own.Text and fonts
Q19. Copy-paste from a PDF gives garbage characters. What is most likely missing?
/ToUnicode CMap on the font/MediaBox/StructTreeRoot/ToUnicode maps them back to Unicode for extraction; without it, extraction is guesswork.Q20. Which font type do modern generators use for arbitrary Unicode text?
Type1TrueTypeType3Type0Type0 (composite) font maps multi-byte codes through a CMap such as Identity-H to glyphs in one descendant CIDFont.Q21. An OCR'd scan has searchable text over the page image. Which text rendering mode draws that text?
Transparency
Q22. Which ExtGState key sets the opacity of fills?
/CA/ca/BM/SMask/ca is the nonstroking (fill) alpha; upper-case /CA is the stroking alpha. It is the same case convention as rg and RG.Q23. What does an isolated transparency group (
/I true) composite its contents against?Q24. Why do PDF/A-1 and PDF/X-1a forbid transparency?
Beyond the page
Encryption and signatures
Q25. In an encrypted PDF, what is encrypted?
Q26. An encrypted file's
/P forbids printing. What stops someone who can open it from printing it?/P/P/P are advisory: honoring them is up to the reader.Q27. What does a signature's
/ByteRange cover?/Contents/Contents string that holds the PKCS#7 / CMS data. Later changes have to be incremental updates, or the signature breaks.Interactive features
Q28. Why should an annotation have an appearance stream (
/AP)?Q29. Which of these is not an action type?
GoToURIWidgetJavaScriptWidget is an annotation subtype, the one form fields use. GoTo, URI, Launch, JavaScript, SubmitForm and Named are actions.Tagged PDF and metadata
Q30. What in the catalog declares that a file follows Tagged PDF conventions?
/StructTreeRoot/MarkInfo << /Marked true >>/Lang/Metadata/MarkInfo /Marked true is the flag. Without it, readers treat a structure tree as a hint. A tagged file needs the flag, the structure tree and marked content on every page.Q31. In a structure element, what does
/K 0 mean?/MCID 0 on the element's page (/Pg)/K holds the children. An integer is an MCID on the element's page; a reference nests another element. It is unrelated to the knockout /K of a transparency group.Q32. How does a viewer find which structure element owns the text under the cursor?
/StructParents, through the /ParentTree, to the entry for that MCID/ToUnicode CMapBDC/StructParents is a key into the parent tree, whose value for the page is an array indexed by MCID. It is the reverse of the /K links, and the two directions must agree.Q33. Every page has a running page number. How should a tagged PDF mark it?
/P structure element/ActualText/Artifact in the content streamQ34. Which kind of metadata was added in PDF 1.4 and is required by PDF/A?
/Info)/Metadata)/MarkInfo dictionary/ID/Metadata and holds RDF/XML. The trailer's /Info dictionary dates from 1.0 and is deprecated in 2.0; the two should agree.Wrapping up
What changed from 1.4 to 1.7
Q35. Which version introduced object streams and cross-reference streams?
Q36. Which of these may be stored inside an object stream?
Q37. In a cross-reference stream, what does a type 2 entry say about an object?
Q38. How many content-stream operators did PDF 1.5, 1.6 and 1.7 add between them?
sh, came in 1.3, so 1.4 and 1.7 have the same 73 operators. Everything new is in dictionaries, filters and file structure.