pymupdf

how to edit/modify text in PDF

how to edit/modify text in PDF Question: I am working on my final year project, so I working on a website where a user can come and read PDF, I am adding some features such as converting currency to their country currency, I am using flask and pymuPDF for my project and I don’t know …

Total answers: 1

Opening PDF within a zip folder fitz.open()

Opening PDF within a zip folder fitz.open() Question: I have a function that opens a zip file, finds a pdf with a given filename, then reads the first page of the pdf to get some specific text. My issue is that after I locate the correct file, I can’t open it to read it. I …

Total answers: 2

Using bezier curves to draw a rectangle with rounded corners in PyMuPDF

Using bezier curves to draw a rectangle with rounded corners in PyMuPDF Question: I would like to use PyMuPDF to draw a rectangle with rounded corners in a pdf. Apparently, there are no particular methods for rounded rectangles. But I was wondering if Shape.draw_bezier() or Shape.draw_curve() could be used for that purpose, making a stroke …

Total answers: 1

Creating and then modifying pdf file in python

Creating and then modifying pdf file in python Question: I am writing some code that merges some pdfs from their file paths and then writes some text on each page of the merged document. My problem is this: I can do both things separately – merge pdfs and write text to a pdf – I …

Total answers: 1

List matches of page.search_for() with PyMuPDF

List matches of page.search_for() with PyMuPDF Question: I’m writing a script to highlight text from a list of quotes in a PDF. The quotes are in the list text_list. I use this code to highlight the text in the PDF: import fitz #Load Document doc = fitz.open(filename) #Iterate over pages for page in doc: # …

Total answers: 1

is there any way to find text using dimensions using pymupdf?

is there any way to find text using dimensions using pymupdf? Question: import fitz doc = fitz.open("" List item ) for page in doc: print(page.search_for("Bank Account")) this program is for get dimensions of given text. i want to do reverse of it, find text using its dimensions. Asked By: chintan bhimani || Source Answers: import …

Total answers: 2

Highlight numbers in a PDF using Python

Highlight numbers in a PDF using Python Question: I was able to highlight words in a PDF (using the below code). However, I would also like to highlight any number contained in the same PDF. How would you complement such code? import fitz # opening the pdf file my_pdf = fitz.open("AR_Finland_2021.pdf") # input text to …

Total answers: 1

Why does PyMupdf Document show the error, no attribute 'new_page', when it is a PDF?

Why does PyMupdf Document show the error, no attribute 'new_page', when it is a PDF? Question: I’m working on annotating a PDF and I want to change its color. I was guided to this helpful link: https://pymupdf.readthedocs.io/en/latest/faq.html#how-to-add-and-modify-annotations I used the code in the link: # -*- coding: utf-8 -*- """ ——————————————————————————- Demo script showing how …

Total answers: 2