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
3d28de75
Commit
3d28de75
authored
Sep 28, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue 1112
parent
69fec641
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
UBExportFullPDF.cpp
src/adaptors/UBExportFullPDF.cpp
+30
-5
No files found.
src/adaptors/UBExportFullPDF.cpp
View file @
3d28de75
...
...
@@ -169,6 +169,7 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS
MergeDescription
mergeInfo
;
int
existingPageCount
=
pDocumentProxy
->
pageCount
();
for
(
int
pageIndex
=
0
;
pageIndex
<
existingPageCount
;
pageIndex
++
)
{
UBGraphicsScene
*
scene
=
UBPersistenceManager
::
persistenceManager
()
->
loadDocumentScene
(
pDocumentProxy
,
pageIndex
);
...
...
@@ -180,18 +181,42 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS
{
QString
pdfName
=
UBPersistenceManager
::
objectDirectory
+
"/"
+
pdfItem
->
fileUuid
().
toString
()
+
".pdf"
;
QString
backgroundPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
pdfName
;
QRectF
annotationsRect
=
scene
->
itemsBoundingRect
();
// Original datas
double
xAnnotation
=
qRound
(
annotationsRect
.
x
());
double
yAnnotation
=
qRound
(
annotationsRect
.
y
());
double
xPdf
=
qRound
(
pdfItem
->
sceneBoundingRect
().
x
());
double
yPdf
=
qRound
(
pdfItem
->
sceneBoundingRect
().
y
());
double
hPdf
=
qRound
(
pdfItem
->
sceneBoundingRect
().
height
());
// Exportation-transformed datas
double
hScaleFactor
=
pageSize
.
width
()
/
scene
->
itemsBoundingRect
().
width
();
double
vScaleFactor
=
pageSize
.
height
()
/
scene
->
itemsBoundingRect
().
height
();
double
scaleFactor
=
qMin
(
hScaleFactor
,
vScaleFactor
);
double
xAnnotationsOffset
=
0
;
double
yAnnotationsOffset
=
0
;
double
hPdfTransformed
=
qRound
(
hPdf
*
scaleFactor
);
qDebug
()
<<
"scene->itemsBoundingRect()"
<<
scene
->
itemsBoundingRect
();
qDebug
()
<<
"pdfItem->boundingRect()"
<<
pdfItem
->
boundingRect
();
qDebug
()
<<
"pdfItem->sceneBoundingRect()"
<<
pdfItem
->
sceneBoundingRect
();
// Here, we force the PDF page to be on the topleft corner of the page
double
xPdfOffset
=
0
;
double
yPdfOffset
=
(
hPdf
-
hPdfTransformed
)
*
mScaleFactor
;
// Now we align the items
xPdfOffset
+=
(
xPdf
-
xAnnotation
)
*
scaleFactor
*
mScaleFactor
;
yPdfOffset
-=
(
yPdf
-
yAnnotation
)
*
scaleFactor
*
mScaleFactor
;
TransformationDescription
pdfTransform
(
xPdfOffset
,
yPdfOffset
,
scaleFactor
,
0
);
TransformationDescription
annotationTransform
(
xAnnotationsOffset
,
yAnnotationsOffset
,
1
,
0
);
MergePageDescription
pageDescription
(
pageSize
.
width
()
*
mScaleFactor
,
pageSize
.
height
()
*
mScaleFactor
,
pdfItem
->
pageNumber
(),
QFile
::
encodeName
(
backgroundPath
).
constData
(),
TransformationDescription
()
,
pdfTransform
,
pageIndex
+
1
,
TransformationDescription
()
,
annotationTransform
,
false
,
false
);
mergeInfo
.
push_back
(
pageDescription
);
...
...
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