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-01-01 11:18:57 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
01531c74e6c54030c696a5ad314d226226df4145
01531c74
1 parent
c0e72d6f
Improve Apple orientation handling
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletions
printing/CHANGELOG.md
printing/ios/Classes/PrintJob.swift
printing/macos/Classes/PrintJob.swift
printing/CHANGELOG.md
View file @
01531c7
...
...
@@ -5,6 +5,7 @@
-
Remove deprecated methods
-
Document.save() now returns a Future
-
Implement pan and zoom on PdfPreview widget
-
Improve orientation handling
## 3.7.2
...
...
printing/ios/Classes/PrintJob.swift
View file @
01531c7
...
...
@@ -27,6 +27,7 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
private
var
pdfDocument
:
CGPDFDocument
?
private
var
urlObservation
:
NSKeyValueObservation
?
private
var
jobName
:
String
?
private
var
orientation
:
UIPrintInfo
.
Orientation
?
public
init
(
printing
:
PrintingPlugin
,
index
:
Int
)
{
self
.
printing
=
printing
...
...
@@ -62,6 +63,10 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
let
printInfo
=
UIPrintInfo
.
printInfo
()
printInfo
.
jobName
=
jobName
!
printInfo
.
outputType
=
.
general
if
orientation
!=
nil
{
printInfo
.
orientation
=
orientation
!
orientation
=
nil
}
controller
.
printInfo
=
printInfo
controller
.
printPageRenderer
=
self
controller
.
present
(
animated
:
true
,
completionHandler
:
completionHandler
)
...
...
@@ -112,6 +117,10 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
return
}
if
size
.
width
>
size
.
height
{
orientation
=
UIPrintInfo
.
Orientation
.
landscape
}
jobName
=
name
self
.
printing
.
onLayout
(
...
...
printing/macos/Classes/PrintJob.swift
View file @
01531c7
...
...
@@ -80,12 +80,16 @@ public class PrintJob: NSView, NSSharingServicePickerDelegate {
public
func
directPrintPdf
(
name
_
:
String
,
data
_
:
Data
,
withPrinter
_
:
String
)
{}
public
func
printPdf
(
name
:
String
,
withPageSize
_
:
CGSize
,
andMargin
_
:
CGRect
)
{
public
func
printPdf
(
name
:
String
,
withPageSize
size
:
CGSize
,
andMargin
_
:
CGRect
)
{
let
sharedInfo
=
NSPrintInfo
.
shared
let
sharedDict
=
sharedInfo
.
dictionary
()
let
printInfoDict
=
NSMutableDictionary
(
dictionary
:
sharedDict
)
let
printInfo
=
NSPrintInfo
(
dictionary
:
printInfoDict
as!
[
NSPrintInfo
.
AttributeKey
:
Any
])
if
size
.
width
>
size
.
height
{
printInfo
.
orientation
=
NSPrintInfo
.
PaperOrientation
.
landscape
}
// Print the custom view
printOperation
=
NSPrintOperation
(
view
:
self
,
printInfo
:
printInfo
)
printOperation
!.
jobTitle
=
name
...
...
Please
register
or
login
to post a comment