The CCPdfDocument class CCPdfDocument manages the lifetime and access to a PDF document. It encapsulates the underlying MuPDF C library resources. This class is considered heavy-weight and should be used carefully for performance-critical or lightweight PDF sessions.
More...
#include <ccpdfdocument.h>
|
| void | document_load (const QString document_path) |
| | document_load Signal emitted when a document is successfully loaded.
|
| |
|
void | pageIndexChanged () |
| | pageIndexChanged Signal emitted when the current page index changes. Used for lightweight UI updates or notifications.
|
| |
|
| | CCPdfDocument (QObject *parent=nullptr) |
| | Default constructor.
|
| |
| | CCPdfDocument (const QString &document_path) |
| | Constructor that opens a document immediately.
|
| |
|
| ~CCPdfDocument () |
| | Destructor. Releases resources associated with the document.
|
| |
|
| Q_DISABLE_COPY (CCPdfDocument) |
| | disable copy object
|
| |
| ErrorCode | load_document (const QString &document_path) |
| | load_document Loads a PDF document from the specified path.
|
| |
| bool | close_document () |
| | close_document Closes the currently loaded document.
|
| |
| bool | document_loaded () const |
| | document_loaded Checks if a document is currently loaded.
|
| |
| std::optional< uint32_t > | document_page () const |
| | document_page Gets the total number of pages in the loaded document.
|
| |
| fz_document * | raw_handle () const |
| | raw_handle Gets the raw pointer to the underlying MuPDF document.
|
| |
| fz_context * | raw_context () const |
| | raw_context Gets the raw pointer to the MuPDF context.
|
| |
| CCPdfMetaInfo | meta_info () const |
| | meta_info Retrieves metadata information from the loaded document.
|
| |
| int | current_page () const |
| | current_page Gets the current page index.
|
| |
| QString | current_path () const |
| | current_path Gets the file path of the currently loaded document.
|
| |
| int | total_pages () const |
| | total_pages Gets the total number of pages in the loaded document.
|
| |
| PageNavigationError | jump (const int page_index) |
| | jump Attempts to jump to a specified page index.
|
| |
The CCPdfDocument class CCPdfDocument manages the lifetime and access to a PDF document. It encapsulates the underlying MuPDF C library resources. This class is considered heavy-weight and should be used carefully for performance-critical or lightweight PDF sessions.
◆ ErrorCode
ErrorCode Enum describing possible error codes during document operations.
| Enumerator |
|---|
| NO_ERROR | No error occurred.
|
| FILE_NOT_EXSIT | File does not exist.
|
| OTHER_MISTAKES | Other unspecified errors.
|
◆ PageNavigationError
PageNavigationError Enum representing errors when navigating pages.
| Enumerator |
|---|
| PAGE_OK | Navigation successful.
|
| PAGE_UNDERFLOW | Page index below first page.
|
| PAGE_OVERFLOW | Page index beyond last page.
|
| PAGE_UNEXSITS | Specified page does not exist.
|
◆ CCPdfDocument() [1/2]
| CCPdfDocument::CCPdfDocument |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
Default constructor.
- Parameters
-
| parent | Optional QObject parent. |
◆ CCPdfDocument() [2/2]
| CCPdfDocument::CCPdfDocument |
( |
const QString & |
document_path | ) |
|
|
explicit |
Constructor that opens a document immediately.
- Parameters
-
| document_path | File path to the PDF document. |
◆ close_document()
| bool CCPdfDocument::close_document |
( |
| ) |
|
close_document Closes the currently loaded document.
- Returns
- True if the document was closed successfully.
◆ current_page()
| int CCPdfDocument::current_page |
( |
| ) |
const |
|
inline |
current_page Gets the current page index.
- Note
- For GCC users, consider using attribute((always_inline)) to force inline for performance as this may be called frequently.
- Returns
- Current page index.
◆ current_path()
| QString CCPdfDocument::current_path |
( |
| ) |
const |
|
inline |
current_path Gets the file path of the currently loaded document.
- Returns
- Current document file path.
◆ document_load
| void CCPdfDocument::document_load |
( |
const QString |
document_path | ) |
|
|
signal |
document_load Signal emitted when a document is successfully loaded.
- Parameters
-
| document_path | The file path of the loaded document. |
◆ document_loaded()
| bool CCPdfDocument::document_loaded |
( |
| ) |
const |
document_loaded Checks if a document is currently loaded.
- Returns
- True if loaded; false otherwise.
◆ document_page()
| std::optional< uint32_t > CCPdfDocument::document_page |
( |
| ) |
const |
document_page Gets the total number of pages in the loaded document.
- Returns
- Optional containing page count if loaded, or empty if none.
◆ jump()
jump Attempts to jump to a specified page index.
- Parameters
-
| page_index | Target page index. |
- Returns
- PageNavigationError indicating navigation result.
◆ load_document()
load_document Loads a PDF document from the specified path.
- Parameters
-
| document_path | File path to load. |
- Returns
- ErrorCode indicating success or failure reason.
◆ meta_info()
meta_info Retrieves metadata information from the loaded document.
- Returns
- CCPdfMetaInfo structure with metadata.
◆ raw_context()
| fz_context * CCPdfDocument::raw_context |
( |
| ) |
const |
raw_context Gets the raw pointer to the MuPDF context.
- Returns
- Pointer to fz_context.
◆ raw_handle()
| fz_document * CCPdfDocument::raw_handle |
( |
| ) |
const |
raw_handle Gets the raw pointer to the underlying MuPDF document.
- Returns
- Pointer to fz_document.
◆ total_pages()
| int CCPdfDocument::total_pages |
( |
| ) |
const |
|
inline |
total_pages Gets the total number of pages in the loaded document.
- Returns
- Total page count.
The documentation for this class was generated from the following files:
- extern_app/pdfReader/mupdf_adapter/ccpdfdocument.h
- extern_app/pdfReader/mupdf_adapter/ccpdfdocument.cpp