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
David PHAM-VAN
2021-03-12 16:51:36 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f947c6cfb682681e80b64ba36dd60acaac90ab02
f947c6cf
1 parent
6326537b
Fix rotated pages display on iOS and macOS
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
printing/CHANGELOG.md
printing/ios/Classes/PrintJob.swift
printing/macos/Classes/PrintJob.swift
printing/CHANGELOG.md
View file @
f947c6c
...
...
@@ -3,6 +3,7 @@
## 5.0.3
-
Fix RichText annotations
-
Fix rotated pages display on iOS and macOS
## 5.0.2
...
...
printing/ios/Classes/PrintJob.swift
View file @
f947c6c
...
...
@@ -302,9 +302,10 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
for
pageNum
in
pages
??
Array
(
0
...
pageCount
-
1
)
{
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
(
rect
.
width
*
scale
)
let
height
=
Int
(
rect
.
height
*
scale
)
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
stride
=
width
*
4
var
data
=
Data
(
repeating
:
0
,
count
:
stride
*
height
)
...
...
@@ -320,7 +321,10 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
bitmapInfo
:
CGImageAlphaInfo
.
premultipliedLast
.
rawValue
)
if
context
!=
nil
{
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
!.
drawPDFPage
(
page
)
}
}
...
...
printing/macos/Classes/PrintJob.swift
View file @
f947c6c
...
...
@@ -249,9 +249,10 @@ public class PrintJob: NSView, NSSharingServicePickerDelegate {
for
pageNum
in
pages
??
Array
(
0
...
pageCount
-
1
)
{
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
(
rect
.
width
*
scale
)
let
height
=
Int
(
rect
.
height
*
scale
)
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
stride
=
width
*
4
var
data
=
Data
(
repeating
:
0
,
count
:
stride
*
height
)
...
...
@@ -266,8 +267,12 @@ public class PrintJob: NSView, NSSharingServicePickerDelegate {
space
:
rgb
,
bitmapInfo
:
CGImageAlphaInfo
.
premultipliedLast
.
rawValue
)
if
context
!=
nil
{
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
!.
drawPDFPage
(
page
)
}
}
...
...
Please
register
or
login
to post a comment