Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
1a425b01
Commit
1a425b01
authored
Feb 18, 2019
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed an issue where pdf 'overlay' was badly scaled
parent
0d6f19c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
49 deletions
+1
-49
UBExportFullPDF.cpp
src/adaptors/UBExportFullPDF.cpp
+1
-49
No files found.
src/adaptors/UBExportFullPDF.cpp
View file @
1a425b01
...
...
@@ -82,55 +82,7 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr
if
(
!
pDocumentProxy
||
filename
.
length
()
==
0
||
pDocumentProxy
->
pageCount
()
==
0
)
return
;
//PDF
qDebug
()
<<
"exporting document to PDF Merger"
<<
filename
;
QPrinter
pdfPrinter
;
pdfPrinter
.
setOutputFormat
(
QPrinter
::
PdfFormat
);
pdfPrinter
.
setResolution
(
UBSettings
::
settings
()
->
pdfResolution
->
get
().
toInt
());
pdfPrinter
.
setOutputFileName
(
filename
);
pdfPrinter
.
setFullPage
(
true
);
QPainter
*
pdfPainter
=
0
;
for
(
int
pageIndex
=
0
;
pageIndex
<
pDocumentProxy
->
pageCount
();
pageIndex
++
)
{
UBGraphicsScene
*
scene
=
UBPersistenceManager
::
persistenceManager
()
->
loadDocumentScene
(
pDocumentProxy
,
pageIndex
);
// set background to white, no grid for PDF output
bool
isDark
=
scene
->
isDarkBackground
();
UBPageBackground
pageBackground
=
scene
->
pageBackground
();
scene
->
setBackground
(
false
,
UBPageBackground
::
plain
);
// set high res rendering
scene
->
setRenderingQuality
(
UBItem
::
RenderingQualityHigh
);
scene
->
setRenderingContext
(
UBGraphicsScene
::
PdfExport
);
QSize
pageSize
=
scene
->
nominalSize
();
UBGraphicsPDFItem
*
pdfItem
=
qgraphicsitem_cast
<
UBGraphicsPDFItem
*>
(
scene
->
backgroundObject
());
if
(
pdfItem
)
mHasPDFBackgrounds
=
true
;
pdfPrinter
.
setPaperSize
(
QSizeF
(
pageSize
.
width
()
*
mScaleFactor
,
pageSize
.
height
()
*
mScaleFactor
),
QPrinter
::
Point
);
if
(
!
pdfPainter
)
pdfPainter
=
new
QPainter
(
&
pdfPrinter
);
if
(
pageIndex
!=
0
)
pdfPrinter
.
newPage
();
//render to PDF
scene
->
setDrawingMode
(
true
);
scene
->
render
(
pdfPainter
,
QRectF
(),
scene
->
normalizedSceneRect
());
//restore screen rendering quality
scene
->
setRenderingContext
(
UBGraphicsScene
::
Screen
);
scene
->
setRenderingQuality
(
UBItem
::
RenderingQualityNormal
);
//restore background state
scene
->
setDrawingMode
(
false
);
scene
->
setBackground
(
isDark
,
pageBackground
);
}
if
(
pdfPainter
)
delete
pdfPainter
;
mSimpleExporter
->
persistsDocument
(
pDocumentProxy
,
filename
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment