Menu

1 / 3

Why Two-Page PDF Layouts Were Harder Than I Expected

DEV Community: swift·Takuma Yamada·3 days ago
#RS8sU1Td
#devtoswift#devto#dev#left#right
Reading 0:00
15s threshold

Two PDF pages overlapped on the screen. After another fix, they moved too far apart. Later, the pages looked better, but search highlights no longer lined up with the text.

I was building MihirakiPDFViewer , an iPad PDF reader for books I had scanned. I wanted to read them as two-page spreads, with an option to show the cover on its own. AI helped me write and revise the code, but deciding whether a fix actually worked took repeated use and more precise descriptions of the expected behavior.

In Part 1 , I described the broader development process. This time, I want to focus on one deceptively small feature: putting two pages next to each other.

This is a development retrospective for beginners, rather than a complete PDF rendering tutorial. The diagrams below explain the layout problems; they are not screenshots from the original debugging sessions.

A layout fix needs a visible target

My early attempts produced overlapping pages, shifted pages, and unwanted space between them.…

Continue reading — create a free account

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