Skip to content

Instantly share code, notes, and snippets.

@terinjokes
Last active January 28, 2022 21:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terinjokes/d2e4b9492b9ca8a02fe3276b27825089 to your computer and use it in GitHub Desktop.
Save terinjokes/d2e4b9492b9ca8a02fe3276b27825089 to your computer and use it in GitHub Desktop.
Retro Tea Breaks Vol. 1 PDF Patch

Retro Tea Break: Vol. 1 QPDF Diff

This is a diff to the Retro Tea Break: Vol. 1 PDF that fixes several problems:

  • Corrects the PDF page number offset, so they match the physical book’s page numbers.
  • Removes the forced page fitting from the link annotations, such as those on the contents listing page.
  • Adds a document outline to the PDF, so your PDF viewer can provide direct links to chapters.

Usage

This patch can be applied using the open source QPDF project, version 10.0.0 or greater.

$ qpdf --object-streams=disable "RetroTeaBreaks Vol. 1.pdf" "rtb.qdf"
$ patch < 01-retroteabreakv1.qdf.diff
$ qpdf --linearize --object-streams=generate --recompress-flate --compression-level=9 rtb.qdf rtb.pdf
--- rtb.qdf.orig 2020-11-07 23:40:10.509205607 -0800
+++ rtb.qdf 2020-11-08 00:02:22.551237861 -0800
@@ -14,9 +14,17 @@
/Pages 6 0 R
/StructTreeRoot 7 0 R
/Type /Catalog
+ /Outlines 6266 0 R
/ViewerPreferences <<
/Direction /L2R
>>
+ /PageLabels <<
+ /Nums [
+ 0 << /S /r >>
+ 2 << /S /D >>
+ 418 << /S /r /St 3>>
+ ]
+ >>
>>
endobj
@@ -2748752,7 +2748760,7 @@
<<
/D [
2998 0 R
- /Fit
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2748763,11 +2748771,7 @@
<<
/D [
3396 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762543,11 +2762547,7 @@
<<
/D [
3002 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762558,11 +2762558,7 @@
<<
/D [
3036 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762573,11 +2762569,7 @@
<<
/D [
3059 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762588,11 +2762580,7 @@
<<
/D [
3080 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762603,11 +2762591,7 @@
<<
/D [
3112 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762618,11 +2762602,7 @@
<<
/D [
3132 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762633,11 +2762613,7 @@
<<
/D [
3156 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762648,11 +2762624,7 @@
<<
/D [
3186 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762663,11 +2762635,7 @@
<<
/D [
3227 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762678,11 +2762646,7 @@
<<
/D [
3255 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762693,11 +2762657,7 @@
<<
/D [
3279 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762708,11 +2762668,7 @@
<<
/D [
3300 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762723,11 +2762679,7 @@
<<
/D [
3319 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762738,11 +2762690,7 @@
<<
/D [
3355 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2762753,11 +2762701,7 @@
<<
/D [
3392 0 R
- /FitR
- -247
- -1
- 562
- 506
+ /XYZ null null null
]
/S /GoTo
>>
@@ -2765147,6 +2765091,225 @@
29766
endobj
+%QDF: ignore_newline
+6266 0 obj
+<<
+ /Count 19
+ /First 6267 0 R
+ /Last 6267 0 R
+ /Type /Outlines
+>>
+endobj
+
+%QDF: ignore_newline
+6267 0 obj
+<<
+ /Title (Retro Tea Breaks: Vol. 1)
+ /Parent 6266 0 R
+ /Count 3
+ /Dest [2988 0 R /XYZ null null null]
+ /First 6268 0 R
+ /Last 6270 0 R
+>>
+endobj
+
+%QDF: ignore_newline
+6268 0 obj
+<<
+ /Title (Contents)
+ /Parent 6267 0 R
+ /Next 6269 0 R
+ /Dest [2996 0 R /XYZ null null null]
+ /Count 15
+ /First 6271 0 R
+ /Last 6285 0 R
+>>
+endobj
+
+%QDF: ignore_newline
+6269 0 obj
+<<
+ /Title (Image credits)
+ /Parent 6267 0 R
+ /Next 6270 0 R
+ /Prev 6268 0 R
+ /Dest [3392 0 R /XYZ null null null]
+>>
+endobj
+
+%QDF: ignore_newline
+6270 0 obj
+<<
+ /Title (Backers)
+ /Parent 6267 0 R
+ /Prev 6269 0 R
+ /Dest [3396 0 R /XYZ null null null]
+>>
+endobj
+
+%QDF: ignore_newline
+6271 0 obj
+<<
+ /Title (Introduction)
+ /Parent 6268 0 R
+ /Next 6272 0 R
+ /Dest [2998 0 R /XYZ null null null]
+>>
+endobj
+
+%QDF: ignore_newline
+6272 0 obj
+<<
+ /Title (A very British coding duo - Philip and Andrew Oliver)
+ /Parent 6268 0 R
+ /Next 6273 0 R
+ /Prev 6271 0 R
+ /Dest [3002 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6273 0 obj
+<<
+ /Title (Pulsating pixels - Al Lowe)
+ /Parent 6268 0 R
+ /Next 6274 0 R
+ /Prev 6272 0 R
+ /Dest [3036 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6274 0 obj
+<<
+ /Title (Micro maestro - George "The Fat Man" Sanger)
+ /Parent 6268 0 R
+ /Next 6275 0 R
+ /Prev 6273 0 R
+ /Dest [3059 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6275 0 obj
+<<
+ /Title (The multimedia age - William D. Volk)
+ /Parent 6268 0 R
+ /Next 6276 0 R
+ /Prev 6274 0 R
+ /Dest [3080 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6276 0 obj
+<<
+ /Title (Back to BASIC - Fran�ois Lionet)
+ /Parent 6268 0 R
+ /Next 6277 0 R
+ /Prev 6275 0 R
+ /Dest [3112 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6277 0 obj
+<<
+ /Title (Pixel art has never been so much fun - Stoo Cambridge)
+ /Parent 6268 0 R
+ /Next 6278 0 R
+ /Prev 6276 0 R
+ /Dest [3132 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6278 0 obj
+<<
+ /Title (From SID to symphony - Rob Hubbard)
+ /Parent 6268 0 R
+ /Next 6279 0 R
+ /Prev 6277 0 R
+ /Dest [3156 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6279 0 obj
+<<
+ /Title (Oh no! - Mike Dailly)
+ /Parent 6268 0 R
+ /Next 6280 0 R
+ /Prev 6278 0 R
+ /Dest [3186 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6280 0 obj
+<<
+ /Title (Rebel SCUMM - David Fox)
+ /Parent 6268 0 R
+ /Next 6281 0 R
+ /Prev 6279 0 R
+ /Dest [3227 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6281 0 obj
+<<
+ /Title (Hail to the king, baby! - Jon St. John)
+ /Parent 6268 0 R
+ /Next 6282 0 R
+ /Prev 6280 0 R
+ /Dest [3255 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6282 0 obj
+<<
+ /Title (Build it and they will come - Ken Silverman)
+ /Parent 6268 0 R
+ /Next 6283 0 R
+ /Prev 6281 0 R
+ /Dest [3279 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6283 0 obj
+<<
+ /Title (The tycoon business - Chris Sawyer)
+ /Parent 6268 0 R
+ /Next 6284 0 R
+ /Prev 6282 0 R
+ /Dest [3300 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6284 0 obj
+<<
+ /Title (Crashing the colour cycle - Mark Ferrari)
+ /Parent 6268 0 R
+ /Next 6285 0 R
+ /Prev 6283 0 R
+ /Dest [3319 0 R /XYZ null null null]
+>>
+endobj
+
+%QPDF: ignore_newline
+6285 0 obj
+<<
+ /Title (Rule Britannia - Richard Garriott)
+ /Parent 6268 0 R
+ /Prev 6284 0 R
+ /Dest [3355 0 R /XYZ null null null]
+>>
+endobj
+
xref
0 6266
0000000000 65535 f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment