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
2020-05-05 17:41:21 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
89ecf5e8507a19bf2b8893e16b9927a93fafa063
89ecf5e8
1 parent
86c5fa39
Fix Swift 5 deprecated function
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
printing/CHANGELOG.md
printing/ios/Classes/PrintJob.swift
printing/macos/Classes/PrintJob.swift
printing/CHANGELOG.md
View file @
89ecf5e
...
...
@@ -4,6 +4,7 @@
-
Add PdfPreview Widget
-
Implement Printing.raster() on Flutter Web
-
Fix Swift 5 deprecated function
## 3.3.1
...
...
printing/ios/Classes/PrintJob.swift
View file @
89ecf5e
...
...
@@ -247,9 +247,17 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
let
stride
=
width
*
4
var
data
=
Data
(
repeating
:
0
,
count
:
stride
*
height
)
data
.
withUnsafeMutableBytes
{
(
ptr
:
UnsafeMutablePointer
<
UInt8
>
)
in
data
.
withUnsafeMutableBytes
{
(
outputBytes
:
UnsafeMutableRawBufferPointer
)
in
let
rgb
=
CGColorSpaceCreateDeviceRGB
()
let
context
=
CGContext
(
data
:
ptr
,
width
:
width
,
height
:
height
,
bitsPerComponent
:
8
,
bytesPerRow
:
stride
,
space
:
rgb
,
bitmapInfo
:
CGImageAlphaInfo
.
premultipliedLast
.
rawValue
)
let
context
=
CGContext
(
data
:
outputBytes
.
baseAddress
?
.
assumingMemoryBound
(
to
:
UInt8
.
self
),
width
:
width
,
height
:
height
,
bitsPerComponent
:
8
,
bytesPerRow
:
stride
,
space
:
rgb
,
bitmapInfo
:
CGImageAlphaInfo
.
premultipliedLast
.
rawValue
)
if
context
!=
nil
{
context
!.
scaleBy
(
x
:
scale
,
y
:
scale
)
context
!.
drawPDFPage
(
page
)
...
...
printing/macos/Classes/PrintJob.swift
View file @
89ecf5e
...
...
@@ -185,9 +185,17 @@ public class PrintJob: NSView, NSSharingServicePickerDelegate {
let
stride
=
width
*
4
var
data
=
Data
(
repeating
:
0
,
count
:
stride
*
height
)
data
.
withUnsafeMutableBytes
{
(
ptr
:
UnsafeMutablePointer
<
UInt8
>
)
in
data
.
withUnsafeMutableBytes
{
(
outputBytes
:
UnsafeMutableRawBufferPointer
)
in
let
rgb
=
CGColorSpaceCreateDeviceRGB
()
let
context
=
CGContext
(
data
:
ptr
,
width
:
width
,
height
:
height
,
bitsPerComponent
:
8
,
bytesPerRow
:
stride
,
space
:
rgb
,
bitmapInfo
:
CGImageAlphaInfo
.
premultipliedLast
.
rawValue
)
let
context
=
CGContext
(
data
:
outputBytes
.
baseAddress
?
.
assumingMemoryBound
(
to
:
UInt8
.
self
),
width
:
width
,
height
:
height
,
bitsPerComponent
:
8
,
bytesPerRow
:
stride
,
space
:
rgb
,
bitmapInfo
:
CGImageAlphaInfo
.
premultipliedLast
.
rawValue
)
if
context
!=
nil
{
context
!.
scaleBy
(
x
:
scale
,
y
:
scale
)
context
!.
drawPDFPage
(
page
)
...
...
Please
register
or
login
to post a comment