Last active
January 8, 2023 20:44
-
-
Save dougluce/0c0de73f16563e592f5c11c1cb1dd449 to your computer and use it in GitHub Desktop.
Tiny hand-composed PDF for unit tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%PDF-1.7 | |
1 0 obj % The list of pages. | |
<< | |
/Type /Pages % Define the pages in the file. | |
/Count 1 % There's just the one. | |
/Kids [2 0 R] % It's defined in object 2. | |
>> | |
endobj | |
2 0 obj % Definition of our single, simple page | |
<< | |
/Type /Page | |
/Parent 1 0 R | |
/Resources << | |
/Font << | |
/F0 << | |
/Type /Font | |
/BaseFont /Times-Italic | |
/Subtype /Type1 | |
>> | |
>> | |
>> | |
/MediaBox [0 0 600 850] | |
/Contents 3 0 R | |
>> | |
3 0 obj % Contents of the page | |
<< /Length 314 >> | |
stream | |
BT % Begin text object | |
/F0 180 Tf % Use super-tall 180-point Times-Italic | |
30 Tz 40 Tc % Smush it narrow and space it out a bit | |
60 400 Td % Stick the text about in the middle | |
(Page Number 1) Tj % It'll be the page number | |
ET % End text object | |
endstream | |
endobj | |
4 0 obj % The page catalog | |
<< | |
/Type /Catalog | |
/Pages 1 0 R | |
>> | |
endobj | |
xref | |
0 0 | |
trailer | |
<< | |
/Root 4 0 R | |
>> | |
startxref | |
984 | |
%%EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🎤🔻
And that's all you need to ship. To PDF-ize it (if you really need a PDF), run this source through
ps2pdf
, which also lets you pick a specific PDF version to target. (By way ofps2pdf12
tagged commands or-dCompatibilityLevel
switch.) It can also be a one-liner in a Makefile or something:(Mine has some software-generated commentary and extraneous metadata, but essentially not worth the effort to try to remove from a one-liner.)