Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created July 8, 2026 09:57
Show Gist options
  • Select an option

  • Save aspose-com-gists/fd466d60fbd0ad8a674a40d4fb9c6ef2 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/fd466d60fbd0ad8a674a40d4fb9c6ef2 to your computer and use it in GitHub Desktop.
Create PDF Booklet in Python

Create PDF Booklet in Python

This tutorial walks Python developers through generating a PDF booklet using Aspose.PDF for Python via .NET. You'll learn to set up the SDK, configure booklet layout, add optional bookmarks, and produce high-quality PDFs for reports, catalogs, or manuals.

Read the full guide here: https://blog.aspose.com/pdf/create-pdf-booklet-in-python/

import aspose.pdf as ap
def create_pdf_booklet(input_path: str, output_path: str, add_bookmarks: bool = True):
# Load source PDF
source_doc = ap.Document(input_path)
# Initialize booklet
booklet = ap.Booklet()
booklet.layout_options = ap.BookletLayoutOptions()
booklet.layout_options.binding = ap.BookletBinding.LEFT
# Add pages
booklet.add_pages(source_doc.pages)
# Optional bookmarks
if add_bookmarks:
bookmarks = ap.OutlineItemCollection()
for i, page in enumerate(source_doc.pages, start=1):
bm = ap.OutlineItem()
bm.title = f"Page {i}"
bm.destination = ap.Destination(page)
bookmarks.add(bm)
booklet.bookmarks = bookmarks
# Save the booklet
booklet.save(output_path)
if __name__ == "__main__":
create_pdf_booklet("input.pdf", "output_booklet.pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment