3 ms·
> When the format was created, computers only had a few KBs of RAM. Yet the format should be capable of editing documents with thousand of pages. The format sol
by kccqzy 7y ago
> When the format was created, computers only had a few KBs of RAM. Yet the format should be capable of editing documents with thousand of pages. The format solves this issue by delegating the memory management to the user.
That's a good decision. Make the file format versatile and powerful. Don't constrain it by the limitations of contemporary hardware.
> Also, the file was made with the assumption it was supposed to be printed, not shared. It is easier to hide parts of the document instead of removing the data.
I agree it's made with the assumption of being printed, but that's part of the appeal—preserving visual fidelity of how the document looks. You can't send people a docx and expect them to see the exact same thing on their screen down to every detail.
And no it's not difficult to remove data. If you know exactly what to remove, it is quite easy to remove things. To remove text, find the Tj or TJ operators, remove them and their arguments. To remove an image, find the Do operator (occasionally BI, ID, EI) and remove it. You might have to perform decompression before doing that. For images, you might have to run another pass to delete the referenced object. But all these are all very easily automated.
> Over the years specification got so complex it became very hard to implement a minimal editor, viewer, parser or generator. If the format was simpler, it would be possible to make "save as PDF" more accessible.
The reason "save to PDF" is difficult to implement from scratch is not because of its complicated specification. Indeed parsers are quite easy to write. The real reason "save to PDF" is difficult to implement is because PDF wants visual fidelity; that comes at the price of specifying where exactly text should be placed, all the way from how paragraphs are flowed to how kerning of the letter is to be handled. Most applications do not care about these details. Most developers hardly have any interest in understanding line-breaking algorithms or interpreting font files to produce the right offsets and glyphs (think ligatures). These things are, rightfully, way beyond the business domain of typical applications and beyond the knowledge of typical developers.
- maest 7y ago> If you know exactly what to remove, it is quite easy to remove things. I think you are severly underselling how difficult it is to do these things. 1. You need to be a specialist in how the PDF format works. 2. From experience, it's not trivial to have logic that correctly handles all possible formatting cases in a PDF. 2.
- piadodjanho 7y agoGiven the constraints of the time when the format was conceived, the pdf format has a great design. I think, embedded designers should have a quick look on the PDF format to learn some tricks on how reduce unneeded memory accesses -- it basically implement a directory inside a file. With the entry removal example, I was trying to show the format was not meant not to be shared. I know it is possible to remove data in other ways, and that probably every modern editor removes the data correctly. But it was not how the format itself deals with it. Of course, hiding entries with the flag had others uses such only print only the pages you currently working on without having to rescan the whole file. I agree most devs don't have interest in learning how to do typesetting. But also, typesetting is quite complex by itself, specially when dealing with non western language. Luckily, projects such Harfbuzz (nowadays, hb is used even my emacs) makes it a lot easier. Like I said in my original post, the format is anachronous. I don't think the format is intrinsically bad, I just think the format is not right for your time. I think we can do better nowadays. PS: I've been thinking, it would be pretty cool to talk with the engineering team that worked on the first spec, and actually know what they were thinking back them and what they would change in it nowadays.