Skip to content

pdf

Class info

Classes

Name Children Inherits
PdfBookmarkModel
prettyqt.pdf.pdfbookmarkmodel
Holds a tree of of links within a PDF document, such as the table of contents.
    PdfDocument
    prettyqt.pdf.pdfdocument
    Loads a PDF document and renders pages from it.
      PdfSearchModel
      prettyqt.pdf.pdfsearchmodel
      Searches for a string in a PDF document and holds the results.

        🛈 DocStrings

        Classes and functions for rendering PDF documents.

        PdfBookmarkModel

        Bases: AbstractItemModelMixin, QPdfBookmarkModel

        Holds a tree of of links within a PDF document, such as the table of contents.

        Source code in prettyqt/pdf/pdfbookmarkmodel.py
        class PdfBookmarkModel(core.AbstractItemModelMixin, pdf.QPdfBookmarkModel):
            """Holds a tree of of links within a PDF document, such as the table of contents."""
        
            def __init__(self, parent: core.QObject | None = None):
                super().__init__(parent)
                self.setDocument(pdf.PdfDocument(self))
        
            def set_document(self, document: datatypes.PathType | pdf.QPdfDocument):
                """Set document for model."""
                if not isinstance(document, pdf.QPdfDocument):
                    path = os.fspath(document)
                    document = pdf.PdfDocument(self)
                    document.load(path)
                self.setDocument(document)
        

        set_document(document: datatypes.PathType | pdf.QPdfDocument)

        Set document for model.

        Source code in prettyqt/pdf/pdfbookmarkmodel.py
        def set_document(self, document: datatypes.PathType | pdf.QPdfDocument):
            """Set document for model."""
            if not isinstance(document, pdf.QPdfDocument):
                path = os.fspath(document)
                document = pdf.PdfDocument(self)
                document.load(path)
            self.setDocument(document)
        

        PdfDocument

        Bases: ObjectMixin, QPdfDocument

        Loads a PDF document and renders pages from it.

        Source code in prettyqt/pdf/pdfdocument.py
        class PdfDocument(core.ObjectMixin, QtPdf.QPdfDocument):
            """Loads a PDF document and renders pages from it."""
        
            def get_error(self) -> ErrorStr:
                """Return current error.
        
                Returns:
                    current error
                """
                return ERROR.inverse[self.error()]
        
            def get_status(self) -> StatusStr:
                """Return current status.
        
                Returns:
                    current status
                """
                return STATUS.inverse[self.status()]
        

        get_error() -> ErrorStr

        Return current error.

        Source code in prettyqt/pdf/pdfdocument.py
        def get_error(self) -> ErrorStr:
            """Return current error.
        
            Returns:
                current error
            """
            return ERROR.inverse[self.error()]
        

        get_status() -> StatusStr

        Return current status.

        Source code in prettyqt/pdf/pdfdocument.py
        def get_status(self) -> StatusStr:
            """Return current status.
        
            Returns:
                current status
            """
            return STATUS.inverse[self.status()]
        

        PdfSearchModel

        Bases: AbstractItemModelMixin, QPdfSearchModel

        Searches for a string in a PDF document and holds the results.

        Source code in prettyqt/pdf/pdfsearchmodel.py
        class PdfSearchModel(core.AbstractItemModelMixin, pdf.QPdfSearchModel):
            """Searches for a string in a PDF document and holds the results."""
        
            def __init__(self, parent: core.QObject | None = None):
                super().__init__(parent)
                doc = pdf.PdfDocument(self)
                self.setDocument(doc)
        
            def set_document(self, document: datatypes.PathType | pdf.QPdfDocument):
                """Set document for model."""
                if not isinstance(document, pdf.QPdfDocument):
                    path = os.fspath(document)
                    document = pdf.PdfDocument(self)
                    document.load(path)
                self.setDocument(document)
        

        set_document(document: datatypes.PathType | pdf.QPdfDocument)

        Set document for model.

        Source code in prettyqt/pdf/pdfsearchmodel.py
        def set_document(self, document: datatypes.PathType | pdf.QPdfDocument):
            """Set document for model."""
            if not isinstance(document, pdf.QPdfDocument):
                path = os.fspath(document)
                document = pdf.PdfDocument(self)
                document.load(path)
            self.setDocument(document)