InDesign PDF Trick: Partial Flattening
Last month, someone on RPG.net made a thread venting about publishers using layers in PDFs, of how it causes sluggish responsiveness on-screen and problems some lower-memory printers have with them. The actual issue has to do with Live Transparency—essentially, having multiple objects overlaid on one another. Every PDF with a background has this, since the background is at least one object and the text frames are another. PDFs with more complex layouts have numerous objects on the page that PDF readers have to render.
And there’s no real getting around this if you’re to have a PDF that’s useful in modern readers. You could entirely flatten a PDF, but then you’re left with text that isn’t copyable or searchable.
I’m going to share the (likely amateur) solution I used over the weekend to make the Katanas & Trenchcoats, Episode 1: Welcome to Darkest Vancouver PDF load faster, and as a bonus is also made the file size smaller. I call this partial flattening. Warning: it isn’t a perfect solution, and I’m more or less an InDesign novice, but this solution might be worth exploring and discussing.
First, Illustrating the Issue
Here’s the spread of Katanas & Trenchcoats pages 2 and 3:
You see the layers that are there, and again to the untrained that looks like a problem. However, it’s the number of objects that are the root issue. In fact, I’ll use layers to solve the problem later.
This spread has 14 objects:
- 1 PSD for the main background
- 6 text outlines for the subtle binary treatment on top of the background (one is hidden by the art)
- 2 for the folios (page numbers at the bottom)
- 1 for the spread’s header
- 1 for the left page body text
- 1 for the right page body text
- 1 PSD for the art
- 1 for the lyrics above the art
When this renders on a slow computer, you can see the reader load the image-intense objects over each other. To hammer home that this isn’t layers, what the PDF reader is looking for is the object’s z-index—what it overlaps and what overlaps it. That’s equally true for a PDF created from an InDesign file with only one layer.
Discovering Partial Flattening
After trying a bunch of different PDF export options in InDesign—none of which were satisfying to me when I tested on hardware both new and old—I threw in the towel. I did what I could, shrugged, and moved into pressing matters in my life. But a week later, I had a shower-thought: what if I exported the background elements and the art as a flat image, and used that as the background.
So I did that, using the spread above as my test. I first moved the art into its own layer, then hid all of the text layers (including the folios), and exported that file as a PDF (with full bleed). I loaded it into Photoshop and saved it as a very high resolution JPG.
I made a copy of my InDesign file, and put a new layer in that for this consolidated background.
I exported a test PDF, and it rendered quickly! But there was a problem: the art looked fine on my desktop, but crap on my iPad.
Not ready to give up yet, I decided to see if tricking the eye into not seeing the live transparency render the art separately could be done. I turned on my art layer and exported another test, and it worked! My iPad rendered the page quickly and with full artistic awesome.
Let me unpack that. Part of the thing about live transparency being slow is that you see the page rendering really slowly. I thought that maybe if I left the background showing the art, but also had the art object on top to be rendered separately, it would only appear to sharpen the art rather than look like it’s filling in a blank space—not unlike how some image rendering shows you a blurry image and sharpens it as it loads, rather than waiting for it to be fully loaded before displaying.
Now my spread has 6 fewer objects on it, and it includes a useful visual trick. With that a success, I did that with the rest of the spreads. I used the same JPG for the spreads that lacked art, and did the same overlay trick for those that had art.
Testing on numerous Windows, OS X, iOS, and Android readers showed it consistently loading faster than the previous version, without a compromise in quality. (We didn’t test on printers, because I don’t have an old printer and I won’t ask people to waste ink and paper.)
To show the relative speed of loading the files, I took videos with my phone of me using my first-generation iPad and Goodreader.
Going Beyond Partial Flattening
Since the idea behind this “partial flattening” trick is “eh, a high-rez JPG of all my background and art elements together is good enough for consumer use,” I was cognitively freed to also downsample all the images. Here’s my relevant export options, which were used for every test export:
No one who tested the new PDF mentioned a quality difference, so it passed my silent test. The images are at 150 ppi, but there are also more images than before, with seven more spread-sized images than the original file. The original Basic Edition was 23.7M, and this export is 14.9M—63% of the original size.
I would have been happy with maybe a 20% increase in file size if the method worked, but getting a reduction that no one noticed was even more of a victory.
Edit: I later did the same exporting options but at 300 ppi, and the file size is 40.7 M—72% larger. I wouldn’t have released that. It’s also a touch more sluggish on my iPad, but not as sluggish as the original PDF.
Not a Perfect Solution
I have the original background layers hidden in my PDF, not deleted, because I figure there’s some antialiasing going in on the background JPGs—especially around the art borders—that I wouldn’t want in print. When I export for print, I turn off the for-download background layer and turn on the for-print ones.
Now, this would be a pain in the ass for a large project. In fact, it was a pain for me because in doing some last-minute revision, I wanted to nudge one art object a bit to the right. That means nudging it, exporting the spread with just the art and background elements, resaving the JPG from that spread, and relinking that background image.
Also, I suspect this isn’t a scalable solution, either for multi-hundred page books or for spreads that have several bits of art or object treatments—especially for books where objects routinely float over other objects that aren’t just background. Sidebars with backgrounds would need to be duplicated into another layer and have their text stripped for their spreads to really benefit from partial flattening. (I didn’t do that with my sidebars in Katanas & Trenchcoats. I decided that more effort than worth it for a simple black box.)
That means I don’t know how often I’ll do this for projects. This as a solution to allow me to export a PDF of a modern version is neat, but it’s a lot of work to set up and to change. Still, it was an interesting experiment that my Katanas & Trenchcoats customers benefitted from!
What about you? What tricks have you tried to make your PDFs better? What am I doing here that could be improved?
Before someone says “hey, make a version that just doesn’t have the background,” that’s a non-solution for me. If I wanted a version without the background, I just wouldn’t have a background. I don’t in some of my books, like Mythender. That and Katanas & Trenchcoats is in the unusual position of having around 60 different editions I need to keep track of, so it’s not just making one extra file—it’s making 60, and at that many there are sure to be ones I screw up exporting.
 Well, that thread happens often, just started by different people. This one only cause my attention because it came up on a Google search for “Katanas & Trenchcoats.”
 Also, it’s just a weak non-solution. The only people who present it as if it’s a good solution are those who’re angry and lack knowledge about the technology.
 I could’ve used InDesign to export to an image, but I prefer Photoshop’s results.