Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
garrettApproachableGeek
2024-01-24 14:21:50 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2024-01-27 12:25:15 -0400
Commit
e5a56e88b13bf090ce18ea75610c016c5d9b0354
e5a56e88
1 parent
2d2b21a3
Output image sized to cropBox instead of mediaBox
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
printing/CHANGELOG.md
printing/ios/Classes/PrintJob.swift
printing/CHANGELOG.md
View file @
e5a56e8
...
...
@@ -5,6 +5,7 @@
-
Refactor html imports
-
Implement PdfActionBarTheme for actions bar and add method scrollToPage
[
Aleksei
]
-
Update cursors in zoom mode for web
[
Aleksei
]
-
Output image sized to cropBox instead of mediaBox (iOS)
[
garrettApproachableGeek
]
## 5.11.1
...
...
printing/ios/Classes/PrintJob.swift
View file @
e5a56e8
...
...
@@ -350,8 +350,11 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
guard
let
page
=
document
.
page
(
at
:
pageNum
+
1
)
else
{
continue
}
let
angle
=
CGFloat
(
page
.
rotationAngle
)
*
CGFloat
.
pi
/
-
180
let
rect
=
page
.
getBoxRect
(
.
mediaBox
)
let
width
=
Int
(
abs
((
cos
(
angle
)
*
rect
.
width
+
sin
(
angle
)
*
rect
.
height
)
*
scale
))
let
height
=
Int
(
abs
((
cos
(
angle
)
*
rect
.
height
+
sin
(
angle
)
*
rect
.
width
)
*
scale
))
let
rectCrop
=
page
.
getBoxRect
(
.
cropBox
)
let
diffHeight
=
rectCrop
.
height
-
rect
.
height
let
diffWidth
=
rectCrop
.
width
-
rect
.
width
let
width
=
Int
(
abs
((
cos
(
angle
)
*
rectCrop
.
width
+
sin
(
angle
)
*
rectCrop
.
height
)
*
scale
))
let
height
=
Int
(
abs
((
cos
(
angle
)
*
rectCrop
.
height
+
sin
(
angle
)
*
rectCrop
.
width
)
*
scale
))
let
stride
=
width
*
4
var
data
=
Data
(
repeating
:
0
,
count
:
stride
*
height
)
...
...
@@ -371,7 +374,8 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
context
!.
translateBy
(
x
:
CGFloat
(
width
)
/
2
,
y
:
CGFloat
(
height
)
/
2
)
context
!.
scaleBy
(
x
:
scale
,
y
:
scale
)
context
!.
rotate
(
by
:
angle
)
context
!.
translateBy
(
x
:
-
rect
.
width
/
2
,
y
:
-
rect
.
height
/
2
)
context
!.
translateBy
(
x
:
-
rectCrop
.
width
/
2
,
y
:
-
rectCrop
.
height
/
2
)
context
!.
translateBy
(
x
:
diffWidth
,
y
:
diffHeight
)
context
!.
drawPDFPage
(
page
)
}
}
...
...
Please
register
or
login
to post a comment