QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsPdfRenderer Class Reference

Utility class for rendering PDF documents. More...

#include <qgspdfrenderer.h>

Public Member Functions

 QgsPdfRenderer (const QgsPdfRenderer &other)=delete
 
 QgsPdfRenderer (const QString &path)
 Constructs a PDF renderer for the file at the specified path.
 
 ~QgsPdfRenderer ()
 
QgsPdfRendereroperator= (const QgsPdfRenderer &other)=delete
 
int pageCount () const
 Returns the number of pages in the PDF.
 
QRectF pageMediaBox (int pageNumber) const
 Returns the media box for the specified page.
 
QString path () const
 Returns the file path of the associated PDF file.
 
bool render (QPainter *painter, const QRectF &painterRect, int pageIndex)
 Renders the PDF from the specified path to a painter.
 

Detailed Description

Utility class for rendering PDF documents.

This functionality is not available on all platforms – it requires a build with the PDF4Qt library support enabled. On other platforms calling these methods will raise a QgsNotSupportedException.

Since
QGIS 3.36

Definition at line 46 of file qgspdfrenderer.h.

Constructor & Destructor Documentation

◆ QgsPdfRenderer() [1/2]

QgsPdfRenderer::QgsPdfRenderer ( const QString &  path)

Constructs a PDF renderer for the file at the specified path.

Definition at line 60 of file qgspdfrenderer.cpp.

◆ ~QgsPdfRenderer()

QgsPdfRenderer::~QgsPdfRenderer ( )
default

◆ QgsPdfRenderer() [2/2]

QgsPdfRenderer::QgsPdfRenderer ( const QgsPdfRenderer other)
delete

Member Function Documentation

◆ operator=()

QgsPdfRenderer & QgsPdfRenderer::operator= ( const QgsPdfRenderer other)
delete

◆ pageCount()

int QgsPdfRenderer::pageCount ( ) const

Returns the number of pages in the PDF.

Exceptions
QgsNotSupportedExceptionon QGIS builds without PDF4Qt library support.

Definition at line 77 of file qgspdfrenderer.cpp.

◆ pageMediaBox()

QRectF QgsPdfRenderer::pageMediaBox ( int  pageNumber) const

Returns the media box for the specified page.

Units are in PDF points.

Exceptions
QgsNotSupportedExceptionon QGIS builds without PDF4Qt library support.

Definition at line 93 of file qgspdfrenderer.cpp.

◆ path()

QString QgsPdfRenderer::path ( ) const
inline

Returns the file path of the associated PDF file.

Definition at line 62 of file qgspdfrenderer.h.

◆ render()

bool QgsPdfRenderer::render ( QPainter *  painter,
const QRectF &  painterRect,
int  pageIndex 
)

Renders the PDF from the specified path to a painter.

The painterRect argument specifies the target rectangle for the PDF page in painter coordinates.

Exceptions
QgsNotSupportedExceptionon QGIS builds without PDF4Qt library support.

Definition at line 106 of file qgspdfrenderer.cpp.


The documentation for this class was generated from the following files: