summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-05-25 16:37:04 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-05-25 17:56:25 +0200
commita05dc747caf5b8fef6bd95a999cb6098f2b4dbc7 (patch)
tree5108f7527eed8a5e1b8083289b5fdbbe37f84a0c /filter
parent3bdd04cd54a42a98f7f679e749f3da0f164ac18f (diff)
tdf#108056 PDF export: work with double page size
Our coordinate system has the origo in the top left corner, PDF's one is at the bottom left corner. So the page height affects the coordinate of all widths and y positions. That page width is 870.25 in the case of the bugdoc, but it was handled as 870 due to the integer rounding. The coordinates and heights are now closer to the expected ones. Change-Id: I9c7d77298df3850bbc170c9ace18120900d7e3fa Reviewed-on: https://gerrit.libreoffice.org/38030 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/pdf/pdfexport.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 2c4849fd9928..4fdd7a450626 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1009,12 +1009,14 @@ void PDFExport::showErrors( const std::set< vcl::PDFWriter::ErrorCode >& rErrors
bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf )
{
- const Size aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MapUnit::MapPoint ) );
+ basegfx::B2DPolygon aSize(tools::Polygon(tools::Rectangle(Point(0, 0), rMtf.GetPrefSize())).getB2DPolygon());
+ basegfx::B2DPolygon aSizePDF(OutputDevice::LogicToLogic(aSize, rMtf.GetPrefMapMode(), MapUnit::MapPoint));
+ basegfx::B2DRange aRangePDF(aSizePDF.getB2DRange());
Point aOrigin;
tools::Rectangle aPageRect( aOrigin, rMtf.GetPrefSize() );
bool bRet = true;
- rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() );
+ rWriter.NewPage( aRangePDF.getWidth(), aRangePDF.getHeight() );
rWriter.SetMapMode( rMtf.GetPrefMapMode() );
vcl::PDFWriter::PlayMetafileContext aCtx;
@@ -1042,7 +1044,7 @@ bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData&
rPDFExtOutDevData.ResetSyncData();
if (!msWatermark.isEmpty())
- ImplWriteWatermark( rWriter, aSizePDF );
+ ImplWriteWatermark( rWriter, Size(aRangePDF.getWidth(), aRangePDF.getHeight()) );
return bRet;
}