-
Notifications
You must be signed in to change notification settings - Fork 551
How to Create and Extract PDF Graphics
PyMuPDF allows creating graphics using PDF draw commands. Look here and here to let inspire you. Just a few pictures:
Now (2020-09-26) it is also possible to extract PDF drawings from a PDF page. This is very different from extracting images! Images are independent files which have been embedded in a PDF.
In contrast to this, drawings are created by using elementary PDF commands for drawing a line, a rectangle or a curve and giving those items line and fill colors. Drawings do not show up in the images list page.getImageList()
of a page. Instead, use page.getDrawings()
; this is a list of dictionaries. Each dictionary contains the information of one drawing.
For more information and a detailed description see here.
HOWTO Button annots with JavaScript
HOWTO work with PDF embedded files
HOWTO extract text from inside rectangles
HOWTO extract text in natural reading order
HOWTO create or extract graphics
HOWTO create your own PDF Drawing
Rectangle inclusion & intersection
Metadata & bookmark maintenance