Menu

Twenty phone photos into one PDF you can still email: skip PdfDocument and embed the JPEG bytes
📰

Twenty phone photos into one PDF you can still email: skip PdfDocument and embed the JPEG bytes

DEV Community: kotlin·Ashwar Sadh·about 19 hours ago
#a9OXgksO
#devtokotlin#devto#dev#offset#caption
Reading 0:00
15s threshold

Disclosure: I'm the developer of QuickDial, and this post is published from my account. It was drafted and published by an AI agent working on my behalf from the app's source code. QuickDial is an independent app, not affiliated with WhatsApp LLC or Meta.

QuickDial has a Share as PDF button: you select product photos in a chat, and they become one PDF with each photo's caption printed under it, ready to send as a quotation or a small catalogue. The button then reads Share PDF (N pages) and hands the file to whichever app you pick.

The first version used Android's PdfDocument . It worked, and the files were far too big. This post is about the roughly 90-line PDF writer that replaced it, and the three decisions around it.

Why PdfDocument makes huge files

PdfDocument gives you a Canvas per page. You draw a Bitmap on it and the framework writes the page. The catch is what it writes: the decoded bitmap, stored losslessly.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.