diff --git a/src/app/qgsmapsavedialog.cpp b/src/app/qgsmapsavedialog.cpp index 47fe4d747098..d285d332e0a5 100644 --- a/src/app/qgsmapsavedialog.cpp +++ b/src/app/qgsmapsavedialog.cpp @@ -26,6 +26,7 @@ #include #include "qgsmapsavedialog.h" +#include "qgsabstractgeopdfexporter.h" #include "qgsguiutils.h" #include "qgis.h" #include "qgisapp.h" @@ -117,11 +118,25 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co mSaveAsRaster->setVisible( true ); this->setWindowTitle( tr( "Save Map as PDF" ) ); + + const bool geoPdfAvailable = QgsAbstractGeoPdfExporter::geoPDFCreationAvailable(); + mGeoPDFGroupBox->setEnabled( geoPdfAvailable ); + if ( !geoPdfAvailable ) + { + mGeoPDFGroupBox->setChecked( false ); + mGeoPDFOptionsStackedWidget->setCurrentIndex( 0 ); + mGeoPdfUnavailableReason->setText( mGeoPdfUnavailableReason::geoPDFAvailabilityExplanation() ); + } + else + { + mGeoPDFOptionsStackedWidget->setCurrentIndex( 1 ); + } break; } case Image: { + mGeoPDFGroupBox->hide(); QPushButton *button = new QPushButton( tr( "Copy to Clipboard" ) ); buttonBox->addButton( button, QDialogButtonBox::ResetRole ); connect( button, &QPushButton::clicked, this, &QgsMapSaveDialog::copyToClipboard ); @@ -457,7 +472,7 @@ void QgsMapSaveDialog::onAccepted() QgsMapSettings ms = QgsMapSettings(); applyMapSettings( ms ); - QgsMapRendererTask *mapRendererTask = new QgsMapRendererTask( ms, fileName, QStringLiteral( "PDF" ), saveAsRaster() ); + QgsMapRendererTask *mapRendererTask = new QgsMapRendererTask( ms, fileName, QStringLiteral( "PDF" ), saveAsRaster(), mGeoPDFGroupBox->isChecked() ); if ( drawAnnotations() ) { diff --git a/src/ui/qgsmapsavedialog.ui b/src/ui/qgsmapsavedialog.ui index a51fa1e2de09..7a04c43a7542 100644 --- a/src/ui/qgsmapsavedialog.ui +++ b/src/ui/qgsmapsavedialog.ui @@ -7,7 +7,7 @@ 0 0 600 - 318 + 439 @@ -16,27 +16,10 @@ - - - - false - - - - - - - false - - - Advanced effects such as blend modes or vector layer transparency cannot be exported as vectors. -Rasterizing the map is recommended when such effects are used. - + + - Rasterize map - - - false + Resolution @@ -50,6 +33,23 @@ Rasterizing the map is recommended when such effects are used. + + + + + + + Extent + + + + + + + Output height + + + @@ -70,17 +70,27 @@ Rasterizing the map is recommended when such effects are used. - - + + - Output height + Output width - - + + + + false + + + Advanced effects such as blend modes or vector layer transparency cannot be exported as vectors. +Rasterizing the map is recommended when such effects are used. + - Output width + Rasterize map + + + false @@ -170,13 +180,6 @@ Rasterizing the map is recommended when such effects are used. - - - - Resolution - - - @@ -203,14 +206,57 @@ Rasterizing the map is recommended when such effects are used. - - + + + + false + + - - + + - Extent + Create Geospatial PDF (GeoPDF) + + + true + + false + + + + + + 1 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + + +