Skip to content

Conversation

@darktasevski
Copy link

This PR adds TTS (Text-to-Speech) functionality for PDF publications by integrating PDFKit-based text extraction capabilities.

Changes:

  • Add PDFResourceContentIterator for extracting text content from PDFs

    • Intelligent paragraph detection using multiple strategies
    • Precise locator positioning with page and paragraph indices
    • Platform-specific implementation using PDFKit (iOS, macOS, Catalyst)
  • Update PDFParser to register ContentService with PDF text iterator

    • Enables automatic TTS support for PDFs with extractable text
    • Maintains backward compatibility with existing code

The implementation is modular and follows the existing ContentIterator pattern used for EPUB publications. I'm using this approach in my app, and it works without any issues (at least, none that I'm aware of).

CleanShot.2025-11-09.at.11.29.58.mp4

This commit adds TTS (Text-to-Speech) functionality for PDF publications by integrating PDFKit-based text extraction capabilities.

Changes:
- Add PDFResourceContentIterator for extracting text content from PDFs
  - Intelligent paragraph detection using multiple strategies
  - Precise locator positioning with page and paragraph indices
  - Platform-specific implementation using PDFKit (iOS, macOS, Catalyst)

- Update PDFParser to register ContentService with PDF text iterator
  - Enables automatic TTS support for PDFs with extractable text
  - Maintains backward compatibility with existing code

The implementation is modular and follows the existing ContentIterator pattern used for EPUB publications, ensuring consistency across the toolkit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant