QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
55 QgsPdfRenderer( const QString &path );
57
58 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#ifdef SIP_RUN
92 QgsPdfRenderer( const QgsPdfRenderer &other );
93#endif
94
95 QString mPath;
96
97#ifdef HAVE_PDF4QT
98 std::unique_ptr< PdfDocumentContainer> mDocumentContainer;
99#endif
100};
101
102#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:210