Skip to content

Commit

Permalink
Force vector output when saving map/canvas as PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed May 12, 2017
1 parent f984242 commit cc7e960
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5881,6 +5881,12 @@ void QgisApp::saveMapAsPdf()
if ( !fileName.isEmpty() )
{
QgsMapSettings ms = QgsMapSettings();

ms.setFlag( QgsMapSettings::ForceVectorOutput, true ); // force vector output (no caching of marker images etc.)
ms.setFlag( QgsMapSettings::Antialiasing, true );

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson May 12, 2017

Collaborator

should these flags be applied to the save map as image export too?

ms.setFlag( QgsMapSettings::DrawEditingInfo, false );
ms.setFlag( QgsMapSettings::DrawSelection, false );

ms.setDestinationCrs( QgsProject::instance()->crs() );
ms.setExtent( dlg.extent() );
ms.setOutputSize( dlg.size() );
Expand Down

5 comments on commit cc7e960

@nirvn
Copy link
Contributor Author

@nirvn nirvn commented on cc7e960 May 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, I forgot to add it to the commit. You are right. The force vector flag isn't necessary but the remaining ones are.

@nirvn
Copy link
Contributor Author

@nirvn nirvn commented on cc7e960 May 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson , thinking about this some more, I'm wondering whether we should have the drawSelection flag on. It'd behave like 2.x's save as image, and it can be useful when someone wants to do a "quick and dirty" visual highlight.

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. But not the editing markers. And antialiasing should respect the canvas setting for antialiasing too.

@nirvn
Copy link
Contributor Author

@nirvn nirvn commented on cc7e960 May 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson , we could consider removing non-antialiasing altogether for QGIS 3.0. Is it really relevant and/or useful to do non-antialiased rendering circa 2017?

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that some people use it to export maps with a limited color palette, so i think the option should remain.

Please sign in to comment.