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
2018-10-28 13:04:24 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fcf9dbc19bd178fa8b67bcbe4005fb7a657daad7
fcf9dbc1
1 parent
a7bb6a97
Update constant case in all files
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
9 deletions
pdf/README.md
pdf/example/main.dart
pdf/lib/src/page.dart
pdf/test/minimal_test.dart
pdf/README.md
View file @
fcf9dbc
...
...
@@ -15,7 +15,7 @@ The coordinate system is using the internal Pdf system:
Example:
```
dart
final
pdf
=
new
PDFDocument
();
final
page
=
new
PDFPage
(
pdf
,
pageFormat:
PDFPageFormat
.
LETTER
);
final
page
=
new
PDFPage
(
pdf
,
pageFormat:
PDFPageFormat
.
letter
);
final
g
=
page
.
getGraphics
();
final
font
=
new
PDFFont
(
pdf
);
...
...
@@ -24,7 +24,7 @@ g.drawRect(50.0, 30.0, 100.0, 50.0);
g
.
fillPath
();
g
.
setColor
(
new
PDFColor
(
0.3
,
0.3
,
0.3
));
g
.
drawString
(
font
,
12.0
,
"Hello World!"
,
5.0
*
PDFPageFormat
.
MM
,
300.0
);
g
.
drawString
(
font
,
12.0
,
"Hello World!"
,
5.0
*
PDFPageFormat
.
mm
,
300.0
);
var
file
=
new
File
(
'file.pdf'
);
file
.
writeAsBytesSync
(
pdf
.
save
());
...
...
pdf/example/main.dart
View file @
fcf9dbc
...
...
@@ -4,19 +4,19 @@ import 'package:pdf/pdf.dart';
void
main
(
)
{
final
pdf
=
new
PDFDocument
(
deflate:
zlib
.
encode
);
final
page
=
new
PDFPage
(
pdf
,
pageFormat:
PDFPageFormat
.
LETTER
);
final
page
=
new
PDFPage
(
pdf
,
pageFormat:
PDFPageFormat
.
letter
);
final
g
=
page
.
getGraphics
();
final
font
=
new
PDFFont
(
pdf
);
final
top
=
page
.
pageFormat
.
height
;
g
.
setColor
(
new
PDFColor
(
0.0
,
1.0
,
1.0
));
g
.
drawRect
(
50.0
*
PDFPageFormat
.
MM
,
top
-
80.0
*
PDFPageFormat
.
MM
,
100.0
*
PDFPageFormat
.
MM
,
50.0
*
PDFPageFormat
.
MM
);
g
.
drawRect
(
50.0
*
PDFPageFormat
.
mm
,
top
-
80.0
*
PDFPageFormat
.
mm
,
100.0
*
PDFPageFormat
.
mm
,
50.0
*
PDFPageFormat
.
mm
);
g
.
fillPath
();
g
.
setColor
(
new
PDFColor
(
0.3
,
0.3
,
0.3
));
g
.
drawString
(
font
,
12.0
,
"Hello World!"
,
10.0
*
PDFPageFormat
.
MM
,
top
-
10.0
*
PDFPageFormat
.
MM
);
g
.
drawString
(
font
,
12.0
,
"Hello World!"
,
10.0
*
PDFPageFormat
.
mm
,
top
-
10.0
*
PDFPageFormat
.
mm
);
var
file
=
new
File
(
'example.pdf'
);
file
.
writeAsBytesSync
(
pdf
.
save
());
...
...
pdf/lib/src/page.dart
View file @
fcf9dbc
...
...
@@ -51,7 +51,7 @@ class PDFPage extends PDFObject {
PDFPage
(
PDFDocument
pdfDocument
,
{
this
.
pageFormat
})
:
super
(
pdfDocument
,
"/Page"
)
{
pdfDocument
.
pdfPageList
.
pages
.
add
(
this
);
if
(
pageFormat
==
null
)
pageFormat
=
PDFPageFormat
.
A
4
;
if
(
pageFormat
==
null
)
pageFormat
=
PDFPageFormat
.
a
4
;
}
/// This returns a PDFGraphics object, which can then be used to render
...
...
pdf/test/minimal_test.dart
View file @
fcf9dbc
...
...
@@ -6,7 +6,7 @@ import "package:test/test.dart";
void
main
(
)
{
test
(
'Pdf1'
,
()
{
var
pdf
=
new
PDFDocument
();
var
page
=
new
PDFPage
(
pdf
,
pageFormat:
PDFPageFormat
.
A
4
);
var
page
=
new
PDFPage
(
pdf
,
pageFormat:
PDFPageFormat
.
a
4
);
var
g
=
page
.
getGraphics
();
g
.
drawLine
(
30.0
,
30.0
,
200.0
,
200.0
);
...
...
Please
register
or
login
to post a comment