write_object_streams.json
The JSON file of the “Making the file smaller” example. The same document written twice, plainly and packed, with what each one weighs and what the packing saved.
This file is a request: an application sends it over the network to the server, which creates the PDF and sends it back. It makes the same page as the Rust and Python versions of this example. A request names every file it uses, never its content; the call carries the request and the files together. A font the server already holds, such as DejaVuSans, is named with nothing attached. Send the request to the address the API page gives.
This request writes out the three weights the library counts for itself: what the plain file weighs, what the packed one weighs, and the difference between them. The library reads them off the two files it has just written, so they follow whatever goes into a document; here they are typed in, and would have to be typed in again.
What this example is for
What a PDF weighs shows when it is being sent to two thousand people, or still kept decades from now, or opened over a telephone connection at the far end of a field. A document spends a large share of itself on bookkeeping — where each page begins, which font goes where, which area is clickable — and every character of it is written out in plain view.
What this example shows
- The same twenty-four pages weighed plainly, then weighed packed.
- Not one mark on any page different between the two.
- Packing stays disabled unless you ask for it, and is never enabled quietly.