Jump to content
Welcome, welcome! Come in and register, and have some developer coffee. 👨‍💻 ×

Contest #1: Create the smallest "Hello World" PDF file (with Results)


Recommended Posts

As you see, you can export as PDF from word processing software, or print text content in Notepad as PDF, but it won't be small. Not even if you go online to apply strong compression on it. 

From my initial finding, a PDF file containing "Kaki.GG" is at least 30KB++, good compression can reduce the file size to about 7KB.

Now, to qualify for this contest (anyway, this is just a contest idea), your PDF file:

  • Contains "Kaki.GG" text string in any font type in any font size and anywhere in the first page.
  • Must stated that the author of the PDF is "Kaki.GG" in meta data.
  • Can be opened by PDF reader and file information not broken

Mine example is less than 1KB.  Can you beat mine?

This inaugural challenge of Kaki.GG's contest is aimed to promote coding and such in Malaysian online community.

I have a lot of ideas doing console apps or command-line utility, but to be fair to everyone, and to make it platform-independent as well, I have this "Create the smallest PDF file" contest for everyone.  Remember, every byte counts.

A 825-byte PDF is still smaller than a 826-byte PDF file. Tweak it!  😉

@MalkuthWhat do you think?  Hehe.

RESULTS (as of 24 Apr 2021, 2:45PM UTC+8):

  1. ChronoX-version 3 (193 bytes)  🏆  🤩
  2. ChronoX- version 2 (275 bytes)
  3. FlierMate (401 bytes)
  4. ChronoX (565 bytes)
  5.  

 

  • Love 1
Link to post
Share on other sites

Since many can copy paste from Stack Overflow, I think need to modify the rule for this contest.

New rule:  Must stated that the author of the PDF is "Kaki.GG" in meta data.

In effect, it means besides PDF page containing "Kaki.GG" text string, the meta data should contains "Kaki.GG" as well in Author column.  Nice?

Link to post
Share on other sites
2 minutes ago, Malkuth said:

This is an interesting challenge. Let's see if someone can beat your 1kb output (it's going to be hard 🤣)

Thank you Malkuth.  Hopefully coders learn something new as well through this challenge. Yeah!

BTW, Stack Overflow's smallest PDF example won't work, because participants need to put in "Author: Kaki.GG" meta data to qualify for this contest.

Link to post
Share on other sites
%PDF-1.4
1 0 obj<</Kids[2 0 R]/Type/Pages/Count 1>>endobj 
2 0 obj<</Resources<</ProcSet 3 0 R>>/Contents 4 0 R/Parent 1 0 R/Type/Page/MediaBox [0 0 99 99]>>endobj 
3 0 obj [/PDF/Text] endobj 
4 0 obj<</Length 34>>
stream
BT
/F1 8 Tf
0 91 Td
(Kaki.GG)Tj
ET
endstream 
endobj 
5 0 obj<</Type/Catalog/Pages 1 0 R>>endobj 
6 0 obj<</Author (kaki.GG)>>endobj 
xref
0 7
0000000000 65535 f 
0000000009 00000 n 
0000000059 00000 n 
0000000167 00000 n 
0000000195 00000 n 
0000000280 00000 n 
0000000324 00000 n 
trailer<</Info 6 0 R/Root 5 0 R/Size 7>>
startxref
362
%%EOF

Just browsing the spec as I never really play with PDF file before so I started with the example provided in the spec. I don't really know if it's strictly conform to the spec but as long as my adobe reader/browser builtin pdf reader can display it, who cares :classic_tongue:. Using unix line terminator, the size of the pdf above should be 565bytes.

  • Love 2
Link to post
Share on other sites
54 minutes ago, ChronoX said:
%PDF-1.4
1 0 obj<</Kids[2 0 R]/Type/Pages/Count 1>>endobj 
2 0 obj<</Resources<</ProcSet 3 0 R>>/Contents 4 0 R/Parent 1 0 R/Type/Page/MediaBox [0 0 99 99]>>endobj 
3 0 obj [/PDF/Text] endobj 
4 0 obj<</Length 34>>
stream
BT
/F1 8 Tf
0 91 Td
(Kaki.GG)Tj
ET
endstream 
endobj 
5 0 obj<</Type/Catalog/Pages 1 0 R>>endobj 
6 0 obj<</Author (kaki.GG)>>endobj 
xref
0 7
0000000000 65535 f 
0000000009 00000 n 
0000000059 00000 n 
0000000167 00000 n 
0000000195 00000 n 
0000000280 00000 n 
0000000324 00000 n 
trailer<</Info 6 0 R/Root 5 0 R/Size 7>>
startxref
362
%%EOF

Just browsing the spec as I never really play with PDF file before so I started with the example provided in the spec. I don't really know if it's strictly conform to the spec but as long as my adobe reader/browser builtin pdf reader can display it, who cares :classic_tongue:. Using unix line terminator, the size of the pdf above should be 565bytes.

 

Good job!  Your entry was accepted.  It is 565 bytes using Unix LF linebreak on my Windows 10. 

Can be opened by Adobe Acrobat Reader and Google Chrome PDF Reader.  Anyone with PDF smaller than 565 bytes? 

Chrono.PNG.824447f8dcfaf8578e99ed075dbf5475.PNG

Chrono.pdf

  • Thanks 1
Link to post
Share on other sites
  • FlierMate changed the title to Contest #1: Create the smallest "Hello World" PDF file (with Results)
  • FlierMate featured and pinned this topic
%PDF-1.
1 0 obj<</Kids[<</Parent 1 0 R/Resources<<>>/Contents 2 0 R>>]>>endobj 2 0 obj<<>>stream
BT/ 9 Tf(Kaki.GG)' ET
endstream
endobj
trailer<</Root<</Pages 1 0 R>>/Info<</Author(Kaki.GG)>>>>

The 193bytes PDF above can only be opened by Adobe Reader. It's based on StackOverflow's post.

  • Like 1
Link to post
Share on other sites
1 hour ago, ChronoX said:
%PDF-1.
1 0 obj<</Kids[<</Parent 1 0 R/Resources<<>>/Contents 2 0 R>>]>>endobj 2 0 obj<<>>stream
BT/ 9 Tf(Kaki.GG)' ET
endstream
endobj
trailer<</Root<</Pages 1 0 R>>/Info<</Author(Kaki.GG)>>>>

The 193bytes PDF above can only be opened by Adobe Reader. It's based on StackOverflow's post.

Yes, trying to open with Google Chrome gives error message "Failed to load PDF document."

I have had PDFs file with XREF (cross reference table) wrongly calculated but in the end only Adobe Acrobat Reader can open it.

Anyhow, I think your 193-byte example can be fixed and still below 400 bytes? 

Link to post
Share on other sites
1 hour ago, ChronoX said:
%PDF-1.
1 0 obj<</Kids[<</Parent 1 0 R/Resources<<>>/Contents 2 0 R>>]>>endobj 2 0 obj<<>>stream
BT/ 9 Tf(Kaki.GG)' ET
endstream
endobj
trailer<</Root<</Pages 1 0 R>>/Info<</Author(Kaki.GG)>>>>

The 193bytes PDF above can only be opened by Adobe Reader. It's based on StackOverflow's post.

The following is the opposite, it can be opened by Google Chrome but could not be opened by Adobe Acrobat Reader. Hah.

228 bytes:

%PDF-1.
1 0 obj<</Type/Catalog/Pages<</Kids [<</Type/Page/Parent 1 0 R/Contents 4 0 R/Resources<<>>>>]>>>>endobj
4 0 obj<<>>stream 
BT/ 72 Tf (Kaki.GG) Tj ET endstream endobj
trailer<</Root 1 0 R/Info<</Author(Kaki.GG)>>>>
%%EOF

 

Link to post
Share on other sites
12 hours ago, FlierMate said:

Yes, trying to open with Google Chrome gives error message "Failed to load PDF document."

I have had PDFs file with XREF (cross reference table) wrongly calculated but in the end only Adobe Acrobat Reader can open it.

Anyhow, I think your 193-byte example can be fixed and still below 400 bytes? 

Of course, tweaking from the 565-bytes and reduced more than half, here's a 275-bytes version, can be opened by both chrome and adobe :

 

%PDF-1.
1 0 obj<</Kids[<</Resources<<>>/Contents 2 0 R/Parent 1 0 R/Type/Page/MediaBox[0 0 99 99]>>]/Type/Pages/Count 1>>endobj
2 0 obj<<>>stream
BT/ 9 Tf(Kaki.GG)' ET
endstream
endobj
3 0 obj<</Type/Catalog/Pages 1 0 R>>endobj
trailer<</Info<</Author(Kaki.GG)>>/Root 3 0 R>>

 

  • Like 1
Link to post
Share on other sites
3 hours ago, ChronoX said:

Of course, tweaking from the 565-bytes and reduced more than half, here's a 275-bytes version, can be opened by both chrome and adobe :

 

%PDF-1.
1 0 obj<</Kids[<</Resources<<>>/Contents 2 0 R/Parent 1 0 R/Type/Page/MediaBox[0 0 99 99]>>]/Type/Pages/Count 1>>endobj
2 0 obj<<>>stream
BT/ 9 Tf(Kaki.GG)' ET
endstream
endobj
3 0 obj<</Type/Catalog/Pages 1 0 R>>endobj
trailer<</Info<</Author(Kaki.GG)>>/Root 3 0 R>>

 

Well done! Tested okay on both PDF readers.  Hopefully you have learned something new from this contest.  🙂

Anyone with PDF file smaller than 275 bytes?

Link to post
Share on other sites
On 4/23/2021 at 11:47 AM, FlierMate said:

Well done! Tested okay on both PDF readers.  Hopefully you have learned something new from this contest.  🙂

Anyone with PDF file smaller than 275 bytes?

sorry. i couldn't resist. now  a 193-bytes PDF that works on both! feels free to squeeze more bytes if u can. i'm outta here :classic_tongue:

%PDF-.
1 0 obj<</Kids[<</Resources<<>>/Contents 2 0 R/Parent 1 0 R>>]>>
2 0 obj<<>>stream
BT/ 9 Tf(Kaki.GG)' ET
endstream
3 0 obj<</Pages 1 0 R>>
trailer<</Info<</Author(Kaki.GG)>>/Root 3 0 R>>

**of course all the non-conformance pdf presented in this topic will not work in all kind of reader/version. my test system is the latest version of acrobat reader dc and chrome/chromium edge in Windows 10 20h2 x32

 

  • Love 1
Link to post
Share on other sites
2 hours ago, ChronoX said:

sorry. i couldn't resist. now  a 193-bytes PDF that works on both! feels free to squeeze more bytes if u can. i'm outta here :classic_tongue:


%PDF-.
1 0 obj<</Kids[<</Resources<<>>/Contents 2 0 R/Parent 1 0 R>>]>>
2 0 obj<<>>stream
BT/ 9 Tf(Kaki.GG)' ET
endstream
3 0 obj<</Pages 1 0 R>>
trailer<</Info<</Author(Kaki.GG)>>/Root 3 0 R>>

**of course all the non-conformance pdf presented in this topic will not work in all kind of reader/version. my test system is the latest version of acrobat reader dc and chrome/chromium edge in Windows 10 20h2 x32

 

Terrific!

I tried smaller but Adobe opened with a blank page even though Chrome can see. I give up!

Well done @ChronoX Looks like you are someone who like the smallest (filesize) the better. 🙂 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...