Skip to content
Discussion options

You must be logged in to vote

You can split a PDF into single pages, each page becoming a 1-page PDF.
You can write those single-page PDFs to memory - as bytes objects - as well. In principle like this:

import pymupdf
src = pymupdf.open("input.pdf")
for page in src:
    doc = pymupdf.open()
    doc.insert_pdf(src, from_page=page.number, to_page=page.number)
    page_data = doc.to_bytes(<save options>)
    doc.close()
    # do something here with this 1-page PDF in memory

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@erotavlas
Comment options

Answer selected by erotavlas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants