Skip to content

v0.6.0

Choose a tag to compare

@yhay81 yhay81 released this 22 Jul 16:34
v0.6.0
dee50a8

Completes page manipulation and saving — the v0.6 theme from the roadmap.

Page objects

  • doc[i] (negative indices, iteration) returns a Page with rotation, mediabox / cropbox / rect (inheritance-resolved), get_text, render, render_svg
  • Structural changes invalidate stale pages with StalePageError (pymupdf-style re-fetch semantics)

Page operations

  • insert_pdf(other, from_page=, to_page=, start_at=) — range merges, reversed ranges, insertion position
  • new_page(), copy_page(), page duplication via repeated numbers in select

TOC & encrypted saving

  • get_toc() / set_toc() with pymupdf-compatible [level, title, page] lists
  • save / tobytes accept user_pw / owner_pw / permissions and write AES-256 (PDF 2.0) output

Robustness & performance

  • Typed exceptions: PdfError (ValueError-compatible), PasswordError, DocumentClosedError, EncryptedDocumentError, StalePageError
  • peek_metadata() fast probe, max_decompressed_size= bomb protection, render bounds
  • Heavy operations release the GIL (concurrent rendering measured ~1.9x on two threads); rendering caches the parsed document
  • render_page(dpi=, background=), save options garbage= / deflate= / object_streams=

Full changelog: https://github.com/yhay81/pylopdf/blob/main/CHANGELOG.md
PyPI: https://pypi.org/project/pylopdf/0.6.0/