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:50:25 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8c04d5b5f9f7dce6f76418ad5bb5c1d43a0d5f48
8c04d5b5
1 parent
3258ca15
Add PdfPage.rotate attribute
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
pdf/CHANGELOG.md
pdf/lib/src/pdf/page.dart
pdf/CHANGELOG.md
View file @
8c04d5b
...
...
@@ -3,6 +3,7 @@
## 3.0.2
-
Fix some linting issues
-
Add PdfPage.rotate attribute
## 3.0.1
...
...
pdf/lib/src/pdf/page.dart
View file @
8c04d5b
...
...
@@ -23,6 +23,21 @@ import 'object.dart';
import
'object_stream.dart'
;
import
'page_format.dart'
;
/// Page rotation
enum
PdfPageRotation
{
/// No rotation
none
,
/// Rotated 90 degree clockwise
rotate90
,
/// Rotated 180 degree clockwise
rotate180
,
/// Rotated 270 degree clockwise
rotate270
,
}
/// Page object, which will hold any contents for this page.
class
PdfPage
extends
PdfObject
with
PdfGraphicStream
{
/// This constructs a Page object, which will hold any contents for this
...
...
@@ -30,6 +45,7 @@ class PdfPage extends PdfObject with PdfGraphicStream {
PdfPage
(
PdfDocument
pdfDocument
,
{
this
.
pageFormat
=
PdfPageFormat
.
standard
,
this
.
rotate
=
PdfPageRotation
.
none
,
int
?
index
,
})
:
super
(
pdfDocument
,
type:
'/Page'
)
{
if
(
index
!=
null
)
{
...
...
@@ -42,11 +58,14 @@ class PdfPage extends PdfObject with PdfGraphicStream {
/// This is this page format, ie the size of the page, margins, and rotation
PdfPageFormat
pageFormat
;
/// The page rotation angle
PdfPageRotation
rotate
;
/// This holds the contents of the page.
List
<
PdfObjectStream
>
contents
=
<
PdfObjectStream
>[];
final
contents
=
<
PdfObjectStream
>[];
/// This holds any Annotations contained within this page.
List
<
PdfAnnot
>
annotations
=
<
PdfAnnot
>[];
final
annotations
=
<
PdfAnnot
>[];
/// This returns a [PdfGraphics] object, which can then be used to render
/// on to this page. If a previous [PdfGraphics] object was used, this object
...
...
@@ -71,6 +90,10 @@ class PdfPage extends PdfObject with PdfGraphicStream {
// the /Parent pages object
params
[
'/Parent'
]
=
pdfDocument
.
pdfPageList
.
ref
();
if
(
rotate
!=
PdfPageRotation
.
none
)
{
params
[
'/Rotate'
]
=
PdfNum
(
rotate
.
index
*
90
);
}
// the /MediaBox for the page size
params
[
'/MediaBox'
]
=
PdfArray
.
fromNum
(<
double
>[
0
,
0
,
pageFormat
.
width
,
pageFormat
.
height
]);
...
...
Please
register
or
login
to post a comment