Commit 4f5cf9d1 authored by Craig Watson's avatar Craig Watson

When exporting to PDF merger, make sure to scale PDF items on the page if necessary

parent 3440be5f
......@@ -62,7 +62,7 @@ UBExportFullPDF::UBExportFullPDF(QObject *parent)
//need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mScaleFactor = 72.0f / dpiCommon;
mScaleFactor = 72.0f / dpiCommon; // 1pt = 1/72 inch
mSimpleExporter = new UBExportPDF();
}
......@@ -206,7 +206,12 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS
xPdfOffset += (xPdf - xAnnotation) * scaleFactor * mScaleFactor;
yPdfOffset -= (yPdf - yAnnotation) * scaleFactor * mScaleFactor;
TransformationDescription pdfTransform(xPdfOffset, yPdfOffset, scaleFactor, 0);
// If the PDF was scaled when added to the scene (e.g if it was loaded from a document with a different DPI
// than the current one), it should also be scaled here.
qreal currentDpi = (UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY()) / 2;
qreal pdfScale = qreal(UBSettings::pageDpi)/currentDpi;
TransformationDescription pdfTransform(xPdfOffset, yPdfOffset, scaleFactor * pdfScale, 0);
TransformationDescription annotationTransform(xAnnotationsOffset, yAnnotationsOffset, 1, 0);
MergePageDescription pageDescription(pageSize.width() * mScaleFactor,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment