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-31 16:18:42 +0200
commit50f309b15f4f47cb357fff04503390f65ae08de1 (patch)
tree80e0240ea3de04b350f1e90b98ea9f46c7f11240 /filter
parentba3f665270006ced34292cd47eabe771a4878869 (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. (cherry picked from commit a05dc747caf5b8fef6bd95a999cb6098f2b4dbc7) Conflicts: include/vcl/pdfwriter.hxx Change-Id: I9c7d77298df3850bbc170c9ace18120900d7e3fa
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 e62fc108c86c..e75a52f9c228 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1018,12 +1018,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(Rectangle(Point(0, 0), rMtf.GetPrefSize())).getB2DPolygon());
+ basegfx::B2DPolygon aSizePDF(OutputDevice::LogicToLogic(aSize, rMtf.GetPrefMapMode(), MapUnit::MapPoint));
+ basegfx::B2DRange aRangePDF(aSizePDF.getB2DRange());
Point aOrigin;
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;
@@ -1051,7 +1053,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;
}