Urgent.News

What's breaking now, across hundreds of outlets.

Tech

How I Prepare PDF Text for an Audiobook

Part 1 of Building All to Audiobook Our sample PDF has a running "CHAPTER ONE" header above "Chapter II. The shore." I remove the repeated margin text before narration, keeping the chapter title and story. Building All to Audiobook I ran into these problems while building All to Audiobook for my mom. After neck surgery, holding a book became difficult for her, and many of the ebooks she wanted to…

Preparing a PDF for an audiobook involves several key steps. The process begins by removing the repeated margin text, keeping only the essential chapter title and story content. This is done by analyzing the margin lines across the document and counting the pages on which each line appears. A line must recur across enough pages before it is considered a header and removed.

The chapter title and opening sentence are retained, even if they share similarities with the margin lines. Footnotes are treated separately, with the reader choosing whether to include them in the main text, skip them, or move them to the end of the chapter. The body text size is estimated from the longer lines on each page, and smaller text near the bottom that starts with a number or note symbol is identified.

This smaller text can continue the same note across pages. The detection of these passages indicates that they resemble footnotes, but the final decision on what to do with them is left to the reader. Each chapter retains its extracted page data, and the cleanup settings produce a separate reading version. When a setting changes, a new reading version is created from the source, ensuring that the original extraction remains available.

The footnote controls allow the reader to preview the result before conversion, and the original extraction is kept for those who change their mind. Chapter boundaries can be provided by PDF bookmarks or inferred from chapter headings and groups of whole pages. Pronunciation replacements occur before the prepared text reaches the voice model, requiring selectable text.

Scanned pages require OCR, which is not included in the app. The reader can inspect the prepared chapters and change the cleanup settings before generating audio. The series covers practical problems encountered while building the All to Audiobook app, the approaches chosen, and areas that still need improvement.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

How to scrape SmartRecruiters jobs with Python (free public API, no key)

Disclosure: I built the Apify actor used in the second half of this post. It is a paid tool (pay per job). The first half is free and uses only SmartRecruiters' public API.

  • SmartRecruiters offers free public API for job scraping without requiring API key.
  • Company ID can be obtained from real job link on company's careers page.
  • API allows filtering by job type, location, release date, and returns job details in JSON.

Account Recovery JWT Evidence With 3 Controls for JWKS Cache Rotation

Device fingerprints can inform account recovery, but recording every fingerprint to explain every decision expands the telemetry footprint without establishing that the score came from a trusted…

  • Verify JWT signature against trusted issuer and audience
  • Retrieve public keys from bounded JWKS cache with refresh interval
  • Separate recovery authorization from risk score assessment

How to Help Google Understand Who You Are: A Developer's Guide to Person Schema, Wikidata and Knowledge Panels

This article was drafted with AI assistance and reviewed and edited by me. The steps, code and results are from my own portfolio.

  • Choose one page as entity home, consistent full name, headshot, one-line bio
  • Use Person schema (JSON-LD) with @id, sameAs links, work/education details, main website link
  • Avoid mistakes: non-existent search feature, spelling inconsistencies, blocked crawler access

More from Sunday 22 November →