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-04-04 08:12:22 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
635c74e23c923a982243375f0d609f0c16cdb45f
635c74e2
1 parent
9dc756b4
Remove useless type specifications
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
17 deletions
pdf/lib/src/pdf/catalog.dart
pdf/lib/src/pdf/data_types.dart
pdf/lib/src/pdf/graphic_stream.dart
pdf/lib/src/pdf/names.dart
pdf/lib/src/pdf/output.dart
pdf/lib/src/pdf/ttffont.dart
pdf/test/data_types_test.dart
pdf/lib/src/pdf/catalog.dart
View file @
635c74e
...
...
@@ -73,7 +73,7 @@ class PdfCatalog extends PdfObject {
params
[
'/PageMode'
]
=
PdfName
(
_PdfPageModes
[
pageMode
.
index
]);
if
(
pdfDocument
.
sign
!=
null
)
{
params
[
'/Perms'
]
=
PdfDict
(
<
String
,
PdfDataType
>
{
params
[
'/Perms'
]
=
PdfDict
({
'/DocMDP'
:
pdfDocument
.
sign
!.
ref
(),
});
}
...
...
@@ -88,7 +88,7 @@ class PdfCatalog extends PdfObject {
}
if
(
widgets
.
isNotEmpty
)
{
params
[
'/AcroForm'
]
=
PdfDict
(
<
String
,
PdfDataType
>
{
params
[
'/AcroForm'
]
=
PdfDict
({
'/SigFlags'
:
PdfNum
(
pdfDocument
.
sign
?.
flagsValue
??
0
),
'/Fields'
:
PdfArray
.
fromObjects
(
widgets
),
});
...
...
pdf/lib/src/pdf/data_types.dart
View file @
635c74e
...
...
@@ -526,7 +526,7 @@ class PdfDict<T extends PdfDataType> extends PdfDataType {
);
}
final
Map
<
String
,
T
>
values
=
<
String
,
T
>{};
final
values
=
<
String
,
T
>{};
bool
get
isNotEmpty
=>
values
.
isNotEmpty
;
...
...
pdf/lib/src/pdf/graphic_stream.dart
View file @
635c74e
...
...
@@ -127,7 +127,7 @@ mixin PdfGraphicStream on PdfObject {
if
(
pdfDocument
.
hasGraphicStates
)
{
// Declare Transparency Group settings
params
[
'/Group'
]
=
PdfDict
(
<
String
,
PdfDataType
>
{
params
[
'/Group'
]
=
PdfDict
({
'/Type'
:
const
PdfName
(
'/Group'
),
'/S'
:
const
PdfName
(
'/Transparency'
),
'/CS'
:
const
PdfName
(
'/DeviceRGB'
),
...
...
pdf/lib/src/pdf/names.dart
View file @
635c74e
...
...
@@ -36,8 +36,8 @@ class PdfNames extends PdfObject {
})
{
assert
(
page
.
pdfDocument
==
pdfDocument
);
_dests
[
name
]
=
PdfDict
(<
String
,
PdfDataType
>{
'/D'
:
PdfArray
(<
PdfDataType
>[
_dests
[
name
]
=
PdfDict
({
'/D'
:
PdfArray
([
page
.
ref
(),
const
PdfName
(
'/XYZ'
),
if
(
posX
==
null
)
const
PdfNull
()
else
PdfNum
(
posX
),
...
...
@@ -63,7 +63,7 @@ class PdfNames extends PdfObject {
final
dict
=
PdfDict
();
if
(
dests
.
values
.
isNotEmpty
)
{
dict
[
'/Names'
]
=
dests
;
dict
[
'/Limits'
]
=
PdfArray
(
<
PdfDataType
>
[
dict
[
'/Limits'
]
=
PdfArray
([
PdfSecString
.
fromString
(
this
,
keys
.
first
),
PdfSecString
.
fromString
(
this
,
keys
.
last
),
]);
...
...
pdf/lib/src/pdf/output.dart
View file @
635c74e
...
...
@@ -112,7 +112,7 @@ class PdfOutput {
params
[
'/Root'
]
=
rootID
!.
ref
();
final
id
=
PdfString
(
rootID
!.
pdfDocument
.
documentID
,
PdfStringFormat
.
binary
);
params
[
'/ID'
]
=
PdfArray
(
<
PdfDataType
>
[
id
,
id
]);
params
[
'/ID'
]
=
PdfArray
([
id
,
id
]);
}
else
{
throw
Exception
(
'Root object is not present in document'
);
}
...
...
pdf/lib/src/pdf/ttffont.dart
View file @
635c74e
...
...
@@ -111,19 +111,19 @@ class PdfTtfFont extends PdfFont {
file
.
buf
.
putBytes
(
data
);
file
.
params
[
'/Length1'
]
=
PdfNum
(
data
.
length
);
final
descendantFont
=
PdfDict
(
<
String
,
PdfDataType
>
{
final
descendantFont
=
PdfDict
({
'/Type'
:
const
PdfName
(
'/Font'
),
'/BaseFont'
:
PdfName
(
'/'
+
fontName
),
'/FontFile2'
:
file
.
ref
(),
'/FontDescriptor'
:
descriptor
.
ref
(),
'/W'
:
PdfArray
(
<
PdfDataType
>
[
'/W'
:
PdfArray
([
const
PdfNum
(
0
),
widthsObject
.
ref
(),
]),
'/CIDToGIDMap'
:
const
PdfName
(
'/Identity'
),
'/DW'
:
const
PdfNum
(
1000
),
'/Subtype'
:
const
PdfName
(
'/CIDFontType2'
),
'/CIDSystemInfo'
:
PdfDict
(
<
String
,
PdfDataType
>
{
'/CIDSystemInfo'
:
PdfDict
({
'/Supplement'
:
const
PdfNum
(
0
),
'/Registry'
:
PdfSecString
.
fromString
(
this
,
'Adobe'
),
'/Ordering'
:
PdfSecString
.
fromString
(
this
,
'Identity-H'
),
...
...
@@ -132,7 +132,7 @@ class PdfTtfFont extends PdfFont {
params
[
'/BaseFont'
]
=
PdfName
(
'/'
+
fontName
);
params
[
'/Encoding'
]
=
const
PdfName
(
'/Identity-H'
);
params
[
'/DescendantFonts'
]
=
PdfArray
(
<
PdfDataType
>
[
descendantFont
]);
params
[
'/DescendantFonts'
]
=
PdfArray
([
descendantFont
]);
params
[
'/ToUnicode'
]
=
unicodeCMap
.
ref
();
charMin
=
0
;
...
...
pdf/test/data_types_test.dart
View file @
635c74e
...
...
@@ -76,11 +76,11 @@ void main() {
test
(
'PdfDataTypes Array'
,
()
{
expect
(
PdfArray
().
toString
(),
'[]'
);
expect
(
PdfArray
(
<
PdfDataType
>
[
const
PdfNum
(
1
),
const
PdfNum
(
2
)]).
toString
(),
PdfArray
([
const
PdfNum
(
1
),
const
PdfNum
(
2
)]).
toString
(),
'[1 2]'
,
);
expect
(
PdfArray
(
<
PdfDataType
>
[
PdfArray
([
const
PdfName
(
'/Name'
),
const
PdfName
(
'/Other'
),
const
PdfBool
(
false
),
...
...
@@ -98,15 +98,15 @@ void main() {
expect
(
PdfDict
().
toString
(),
'<<>>'
);
expect
(
PdfDict
(
<
String
,
PdfDataType
>
{
PdfDict
({
'/Name'
:
const
PdfName
(
'/Value'
),
'/Bool'
:
const
PdfBool
(
true
),
'/Num'
:
const
PdfNum
(
42
),
'/String'
:
PdfString
.
fromString
(
'hello'
),
'/Null'
:
const
PdfNull
(),
'/Indirect'
:
const
PdfIndirect
(
55
,
0
),
'/Array'
:
PdfArray
(<
PdfDataType
>[]),
'/Dict'
:
PdfDict
(<
String
,
PdfDataType
>{}),
'/Array'
:
PdfArray
<
PdfDataType
>([]),
'/Dict'
:
PdfDict
<
PdfDataType
>({}),
}).
toString
(),
'<</Name/Value/Bool true/Num 42/String(hello)/Null null/Indirect 55 0 R/Array[]/Dict<<>>>>'
,
);
...
...
Please
register
or
login
to post a comment