Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Python PDF Handling from Beginner to Winner (PyMuPDF)
Rating: 4.3 out of 5(16 ratings)
137 students

Python PDF Handling from Beginner to Winner (PyMuPDF)

Learn How to Learn and Take the Best Out of Python to Control PDFs
Created byHugo Ferro
Last updated 9/2025
English

What you'll learn

  • Get PDF Metadata
  • Scale, Rotate, Split, Merge, Crop Pages
  • Get PDF Images
  • Get PDF Text
  • Get PDF Hyperlinks
  • Add Watermarks

Course content

1 section16 lectures3h 45m total length
  • Introduction [Part 0 of 14]8:25

    Here we will see what we need to do this course! Also we will create a Python Virtual Environment!

  • Visual Studio Code Extensions [Part 1 of 14]1:48

    Here I will talk about Visual Studio Code Extensions for Python!

  • Install PyMuPDF [Part 2 of 14]2:43

    Here we will install a module named PyMuPDF that allow us to handle PDF files!

  • Get Number of Pages [Part 3 of 14]7:26

    Here we will learn how to open a file with PyMuPDF and read the total number of pages.

    keywords: fitz, open, dir, document.page_count.

  • Get Document Info [Part 4 of 14]14:54

    Here we will read metadata from a PDF file, we will get the title, author, producer and table of content!

    keywords: document.metadata, format, title, author, producer, document.get_toc.

  • Get Text from Pages [Part 5 of 14]28:13

    Here we will read the text of each page and save it into txt files!

    keywords: document.pages, page.number, page.get_text.

  • Get Images from Pages [Part 6 of 14]22:28

    Here we will save into png files all the images found in all pages!

    keywords: document.pages, page.get_images, xref, document.extract_image, Pixmap.

  • Get URLs from Pages [Part 7 of 14]14:07

    Here we will search and get (if present) all the url links found in the PDF document.

    keywords: document.has_links, page.get_links.

  • Make Images from Pages [Part 8 of 14]16:22

    Here we will learn how to take snapshots from each page and save into png files!

    keywords: Matrix, page.get_pixmap, document.get_page_pixmap, __getitem__.

  • Scale Pages [Part 9 of 14]19:36

    Here we will learn how to resize the PDF pages!

    keywords: paper_rect, new_page, show_pdf_page, get_toc, set_toc.

  • Rotate Pages [Part 10 of 14]10:12

    Here we will learn how to rotate the pages of a PDF file.

    keywords: rotation, set_rotation.

  • Split Pages [Part 11 of 14]16:03

    Here we will learn how to save part of a PDF file into another PDF file!

    keywords: document.pages, document.page_count, insert_pdf.

  • Merge Pages [Part 12 of 14]8:10

    Here we will learn how to join pages from two different PDF files into one PDF!

    keywords: document.pages, document.page_count, insert_pdf, min.

  • Crop Pages [Part 13 of 14]15:23

    Here we will learn how to make pages smaller and bigger!

    keywords: page.rect, set_cropbox, set_mediabox, Page Boxes, MediaBox, CropBox, BleedBox, TrimBox & ArtBox.

  • Add Watermark [Part 14 of 14]24:06

    Here we will learn how to add watermarks to our PDF files!

    keywords: add_stamp_annot, page.rect, add_circle_annot, TextWriter, write_text, clean_contents.

  • Get Text with OCR [BONUS 1]16:02

    Here we will use OCR (Optical Character Recognition) to extract text from our pdf!

    keywords: easyocr, pytesseract, paddleocr, ocrmypdf, keras-ocr.

Requirements

  • Basic Knowledge about Python
  • You need Python 3.8.x or later
  • Visual Studio Code (Recommended)
  • Visual Studio Code "Python from Microsoft" and "Pylance from Microsoft" extensions
  • Eager to learn

Description

Welcome to Python PDF Handling from Beginner to Winner (PyMuPDF)! A great course on Manipulating PDF files!


Together we will learn, explore and have fun taking the most out of Python and several Python Modules to read/modify PDF documents.


Each session will be composed by several challenges that we will solve by exploring the available documentation, reading Python Modules source code and also debugging. By the end you will be able to unravel from situations where you cannot find help anywhere else! Sounds good right?


After taking the first session you will know how to:

  • Get the total number of pages of a PDF document;

  • Get its metadata, author, title, table of content;

  • Extract text from a PDF file and write it into a txt file;

  • Extract images from a PDF file and save it into a png file;

  • Read hyperlinks from a PDF document;

  • Take snapshots from pages and save them as png files;

  • Change pages paper size from A4 portrait, A4 landscape, and others;

  • Rotate the pages from a PDF file;

  • Split odd from even pages so it would be easier to print them;

  • Join together pages from several PDF files into a new PDF document;

  • Change pages visible area, crop the pages;

  • And add watermarks to PDF pages.


Sounds already fun right?

Do you know that we can have input forms in a PDF file? And that we can add JavaScript functionalities to a PDF file? Yeah we will do that too!


Join with me to this great challenge that is learning!

Who this course is for:

  • Python dev Beginner/Intermediate who wants to automate processing of PDF documents
  • Anyone interested in editing PDF files programmatically
  • Everyone who wants to do more with less