QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 "qgsconfig.h"
22
23#include <memory>
24
25#include "qgis_core.h"
26#include "qgis_sip.h"
27
28#include <QString>
29
30#ifdef HAVE_PDF4QT
31#endif
32
33class QPainter;
34class QRectF;
35class PdfDocumentContainer;
36
37
49class CORE_EXPORT QgsPdfRenderer
50{
51 public:
52
56 QgsPdfRenderer( const QString &path );
58
59 QgsPdfRenderer( const QgsPdfRenderer &other ) = delete;
60 QgsPdfRenderer &operator=( const QgsPdfRenderer &other ) = delete;
61
65 QString path() const { return mPath; }
66
72 int pageCount() const SIP_THROW( QgsNotSupportedException );
73
79 QRectF pageMediaBox( int pageNumber ) const SIP_THROW( QgsNotSupportedException );
80
89 bool render( QPainter *painter, const QRectF &painterRect, int pageIndex ) SIP_THROW( QgsNotSupportedException );
90
91 private:
92
93#ifdef SIP_RUN
94 QgsPdfRenderer( const QgsPdfRenderer &other );
95#endif
96
97 QString mPath;
98
99#ifdef HAVE_PDF4QT
100 std::unique_ptr< PdfDocumentContainer> mDocumentContainer;
101#endif
102};
103
104#endif // QGSPDFRENDERER_H
Custom exception class which is raised when an operation is not supported.
Utility class for rendering PDF documents.
QgsPdfRenderer(const QString &path)
Constructs a PDF renderer for the file at the specified path.
QgsPdfRenderer & operator=(const QgsPdfRenderer &other)=delete
QgsPdfRenderer(const QgsPdfRenderer &other)=delete
QString path() const
Returns the file path of the associated PDF file.
#define SIP_THROW(name,...)
Definition qgis_sip.h:211