39 QTemporaryFile tmpFile;
42 std::unique_ptr<QgsMapRendererTask> pdfTask = renderer.
getPdf( tmpFile.fileName() );
44 pdfTask->waitForFinished();
45 response.
setHeader(
"Content-Type",
"application/pdf" );
46 response.
write( tmpFile.readAll() );
static QgsTaskManager * taskManager()
Returns the application's task manager, used for managing application wide background task handling.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins.
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device.
virtual void setHeader(const QString &key, const QString &value)=0
Set Header entry Add Header entry to the response Note that it is usually an error to set Header afte...
long addTask(QgsTask *task, int priority=0)
Adds a task to the manager.
Map renderer for WMS requests.
std::unique_ptr< QgsMapRendererTask > getPdf(const QString &tmpFileName)
Returns a configured pdf export task.
Rendering context for the WMS renderer.
void setParameters(const QgsWmsParameters ¶meters)
Sets WMS parameters.
void setFlag(Flag flag, bool on=true)
Sets or unsets a rendering flag according to the on value.
Class defining request interface passed to WMS service.
const QgsWmsParameters & wmsParameters() const
Returns the parameters interpreted for the WMS service.
Median cut implementation.
void writeAsPdf(QgsServerInterface *serverIface, const QgsProject *project, const QgsWmsRequest &request, QgsServerResponse &response)
Output GetMap response in PDF format.