PDFFile

class PDFFile.PDFFile(filePath, to_pickle=False)

Loads the PDFFile to modify it

delete_object(object_number: int)

Removes an object from the objects dict

Parameters:object_number – Object number
delete_page(page_number: int)

Deletes the given page

Parameters:page_number – Number of the page
extract_object(number)

Extracts object from the pdf file

Parameters:number – XrefIndex of object
Returns:PDF Object
getFromPDFDict(key: int)

Get object from pdf

Parameters:key – object number
Returns:PDFObject
get_RootOutline() → PDFStructureObjects.PDFObject

Gets the root outline object

Returns:Outline PDFObject
get_document_catalog()

Gets the document_catalog from the pdf

Returns:Document catalog
get_firstOutlineItem() → PDFStructureObjects.PDFObject

Get the first actual OutlineItem

Returns:First actual OutlineItem
get_lastOutlineItem() → PDFStructureObjects.PDFObject

Get the last actual OutlineItem

Returns:Last actual OutlineItem
get_page_root()

Extracts the page root from the pdf

Returns:PDF Root
get_pages() → list

Gathers all pages

Returns:list of pages
has_outline()

Checks if the document has an outline

increment_references(n: int) → None

Increments all Indirect Object references of the pdf

Parameters:n – offset
removeFromPDFDict(key: int)

Removes object from pdf

Parameters:key – object number
rotate_all(rotation: int)

Rotates all pages

Parameters:rotation – Degrees
rotate_page(index: int, rotation: int)

Rotates the given page

Parameters:
  • index – Page index
  • rotation – Degrees
save(path)

Writes the contents of the pdf to disk

seek_object(number: int) → None

Moves the pointer to the nth object

Parameters:number – Object’s index in XRefTable