QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgspdfrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspdfrenderer.h
3 -------------------
4 begin : December 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPDFRENDERER_H
19#define QGSPDFRENDERER_H
20
21#include "qgis_sip.h"
22#include "qgis_core.h"
23#include "qgsconfig.h"
24#include <QString>
25#include <memory>
26
27#ifdef HAVE_PDF4QT
28#endif
29
30class QPainter;
31class QRectF;
32class PdfDocumentContainer;
33
34
46class CORE_EXPORT QgsPdfRenderer
47{
48 public:
49
53 QgsPdfRenderer( const QString &path );
55
57 QgsPdfRenderer( const QgsPdfRenderer &other ) = delete;
59 QgsPdfRenderer &operator=( const QgsPdfRenderer &other ) = delete;
60
64 QString path() const { return mPath; }
65
71 int pageCount() const SIP_THROW( QgsNotSupportedException );
72
78 QRectF pageMediaBox( int pageNumber ) const SIP_THROW( QgsNotSupportedException );
79
88 bool render( QPainter *painter, const QRectF &painterRect, int pageIndex ) SIP_THROW( QgsNotSupportedException );
89
90 private:
91
92#ifdef SIP_RUN
93 QgsPdfRenderer( const QgsPdfRenderer &other );
94#endif
95
96 QString mPath;
97
98#ifdef HAVE_PDF4QT
99 std::unique_ptr< PdfDocumentContainer> mDocumentContainer;
100#endif
101};
102
103#endif // QGSPDFRENDERER_H
Custom exception class which is raised when an operation is not supported.
Utility class for rendering PDF documents.
QgsPdfRenderer & operator=(const QgsPdfRenderer &other)=delete
QgsPdfRenderer cannot be copied.
QgsPdfRenderer(const QgsPdfRenderer &other)=delete
QgsPdfRenderer cannot be copied.
QString path() const
Returns the file path of the associated PDF file.
#define SIP_THROW(name,...)
Definition qgis_sip.h:203