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
2019-06-24 07:06:13 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
52a70d1a3b9581e55f2de8375769f11770cd748d
52a70d1a
1 parent
2ce0e570
Improve pdf output
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
18 deletions
pdf/lib/src/output.dart
pdf/lib/src/stream.dart
pdf/lib/src/output.dart
View file @
52a70d1
...
...
@@ -96,31 +96,28 @@ class PdfOutput {
}
// now the trailer object
os
.
putString
(
'trailer
\n
<<
\n
'
);
os
.
putString
(
'trailer
\n
'
);
final
Map
<
String
,
PdfStream
>
params
=
<
String
,
PdfStream
>{};
// the number of entries (REQUIRED)
os
.
putString
(
'/Size '
);
os
.
putString
((
offsets
.
length
+
1
).
toString
());
os
.
putString
(
'
\n
'
);
params
[
'/Size'
]
=
PdfStream
.
intNum
(
offsets
.
length
+
1
);
// the /Root catalog indirect reference (REQUIRED)
if
(
rootID
!=
null
)
{
os
.
putString
(
'/Root '
);
os
.
putStream
(
rootID
.
ref
());
os
.
putString
(
'
\n
'
);
params
[
'/Root'
]
=
rootID
.
ref
();
}
else
{
throw
Exception
(
'Root object is not present in document'
);
}
// the /Info reference (OPTIONAL)
if
(
infoID
!=
null
)
{
os
.
putString
(
'/Info '
);
os
.
putStream
(
infoID
.
ref
());
os
.
putString
(
'
\n
'
);
params
[
'/Info'
]
=
infoID
.
ref
();
}
// end the trailer object
os
.
putString
(
'>>
\n
startxref
\n
$xref
\n
%%EOF
\n
'
);
os
.
putDictionary
(
params
);
os
.
putString
(
'
\n
startxref
\n
$xref
\n
%%EOF
\n
'
);
}
/// Writes a block of references to the Pdf file
...
...
pdf/lib/src/stream.dart
View file @
52a70d1
...
...
@@ -184,13 +184,8 @@ class PdfStream {
PdfStream
()..
putDictionary
(
values
);
void
putObjectDictionary
(
Map
<
String
,
PdfObject
>
values
)
{
putString
(
'<< '
);
values
.
forEach
((
String
k
,
PdfObject
v
)
{
putString
(
'
$k
'
);
putStream
(
v
.
ref
());
putString
(
' '
);
});
putString
(
'>>'
);
putDictionary
(
values
.
map
((
String
string
,
PdfObject
object
)
=>
MapEntry
<
String
,
PdfStream
>(
string
,
object
.
ref
())));
}
int
get
offset
=>
_stream
.
length
;
...
...
Please
register
or
login
to post a comment