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
2020-11-24 08:47:37 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b533e4048acecb95bbf130b635e2d25534f3fd4d
b533e404
1 parent
66b3fa6f
Opt-out from dart library
Show whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
778 additions
and
327 deletions
pdf/CHANGELOG.md
pdf/lib/pdf.dart
pdf/lib/src/annotation.dart
pdf/lib/src/arabic.dart
pdf/lib/src/array.dart
pdf/lib/src/ascii85.dart
pdf/lib/src/border.dart
pdf/lib/src/catalog.dart
pdf/lib/src/color.dart
pdf/lib/src/colors.dart
pdf/lib/src/data_types.dart
pdf/lib/src/document.dart
pdf/lib/src/encryption.dart
pdf/lib/src/exif.dart
pdf/lib/src/font.dart
pdf/lib/src/font_descriptor.dart
pdf/lib/src/font_metrics.dart
pdf/lib/src/formxobject.dart
pdf/lib/src/function.dart
pdf/lib/src/graphic_state.dart
pdf/lib/src/graphic_stream.dart
pdf/lib/src/graphics.dart
pdf/lib/src/image.dart
pdf/lib/src/info.dart
pdf/lib/src/names.dart
pdf/lib/src/object.dart
pdf/lib/src/object_stream.dart
pdf/lib/src/outline.dart
pdf/lib/src/output.dart
pdf/lib/src/page.dart
pdf/lib/src/page_format.dart
pdf/lib/src/page_list.dart
pdf/lib/src/point.dart
pdf/lib/src/rect.dart
pdf/lib/src/shading.dart
pdf/lib/src/signature.dart
pdf/lib/src/stream.dart
pdf/lib/src/ttf_parser.dart
pdf/lib/src/ttf_writer.dart
pdf/lib/src/ttffont.dart
pdf/lib/src/type1_font.dart
pdf/lib/src/type1_fonts.dart
pdf/lib/src/unicode_cmap.dart
pdf/lib/src/xobject.dart
pdf/lib/src/xref.dart
pdf/lib/widgets.dart
pdf/lib/widgets/annotations.dart
pdf/lib/widgets/barcode.dart
pdf/lib/widgets/basic.dart
pdf/lib/widgets/chart/bar_chart.dart
pdf/lib/widgets/chart/chart.dart
pdf/lib/widgets/chart/grid_axis.dart
pdf/lib/widgets/chart/grid_cartesian.dart
pdf/lib/widgets/chart/legend.dart
pdf/lib/widgets/chart/line_chart.dart
pdf/lib/widgets/clip.dart
pdf/lib/widgets/container.dart
pdf/lib/widgets/content.dart
pdf/lib/widgets/decoration.dart
pdf/lib/widgets/document.dart
pdf/lib/widgets/flex.dart
pdf/lib/widgets/font.dart
pdf/lib/widgets/forms.dart
pdf/lib/widgets/geometry.dart
pdf/lib/widgets/grid_view.dart
pdf/lib/widgets/icon.dart
pdf/lib/widgets/image.dart
pdf/lib/widgets/image_provider.dart
pdf/lib/widgets/multi_page.dart
pdf/lib/widgets/page.dart
pdf/lib/widgets/page_theme.dart
pdf/lib/widgets/partitions.dart
pdf/lib/widgets/placeholders.dart
pdf/lib/widgets/progress.dart
pdf/lib/widgets/qrcode.dart
pdf/lib/widgets/stack.dart
pdf/lib/widgets/table.dart
pdf/lib/widgets/text.dart
pdf/lib/widgets/text_style.dart
pdf/lib/widgets/theme.dart
pdf/lib/widgets/widget.dart
pdf/lib/widgets/wrap.dart
pdf/test/data_types_test.dart
pdf/test/ttf_test.dart
pdf/CHANGELOG.md
View file @
b533e40
...
...
@@ -10,6 +10,7 @@
-
Fix PdfOutlineMode enum
-
Improve API documentation
-
Add support for Icon Fonts (MaterialIcons)
-
Opt-out from dart library
## 1.12.0
...
...
pdf/lib/pdf.dart
View file @
b533e40
...
...
@@ -14,64 +14,27 @@
* limitations under the License.
*/
library
pdf
;
import
'dart:collection'
;
import
'dart:convert'
;
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:crypto/crypto.dart'
;
import
'package:image/image.dart'
as
im
;
import
'package:meta/meta.dart'
;
import
'package:path_parsing/path_parsing.dart'
;
import
'package:utf/utf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'io/interface.dart'
if
(
dart
.
library
.
io
)
'io/vm.dart'
if
(
dart
.
library
.
js
)
'io/js.dart'
;
part
'src/annotation.dart'
;
part
'src/arabic.dart'
;
part
'src/array.dart'
;
part
'src/ascii85.dart'
;
part
'src/border.dart'
;
part
'src/catalog.dart'
;
part
'src/color.dart'
;
part
'src/colors.dart'
;
part
'src/data_types.dart'
;
part
'src/document.dart'
;
part
'src/encryption.dart'
;
part
'src/exif.dart'
;
part
'src/font.dart'
;
part
'src/font_descriptor.dart'
;
part
'src/font_metrics.dart'
;
part
'src/formxobject.dart'
;
part
'src/function.dart'
;
part
'src/graphic_state.dart'
;
part
'src/graphic_stream.dart'
;
part
'src/graphics.dart'
;
part
'src/image.dart'
;
part
'src/info.dart'
;
part
'src/names.dart'
;
part
'src/object.dart'
;
part
'src/object_stream.dart'
;
part
'src/outline.dart'
;
part
'src/output.dart'
;
part
'src/page.dart'
;
part
'src/page_format.dart'
;
part
'src/page_list.dart'
;
part
'src/point.dart'
;
part
'src/rect.dart'
;
part
'src/shading.dart'
;
part
'src/signature.dart'
;
part
'src/stream.dart'
;
part
'src/ttf_parser.dart'
;
part
'src/ttf_writer.dart'
;
part
'src/ttffont.dart'
;
part
'src/type1_font.dart'
;
part
'src/type1_fonts.dart'
;
part
'src/unicode_cmap.dart'
;
part
'src/xobject.dart'
;
part
'src/xref.dart'
;
export
'src/annotation.dart'
;
export
'src/arabic.dart'
;
export
'src/border.dart'
;
export
'src/color.dart'
;
export
'src/colors.dart'
;
export
'src/document.dart'
;
export
'src/encryption.dart'
;
export
'src/exif.dart'
;
export
'src/font.dart'
;
export
'src/font_metrics.dart'
;
export
'src/function.dart'
;
export
'src/graphic_state.dart'
;
export
'src/graphics.dart'
;
export
'src/image.dart'
;
export
'src/info.dart'
;
export
'src/outline.dart'
;
export
'src/page.dart'
;
export
'src/page_format.dart'
;
export
'src/point.dart'
;
export
'src/rect.dart'
;
export
'src/shading.dart'
;
export
'src/signature.dart'
;
export
'src/ttf_parser.dart'
;
export
'src/ttffont.dart'
;
...
...
pdf/lib/src/annotation.dart
View file @
b533e40
...
...
@@ -14,7 +14,21 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'border.dart'
;
import
'color.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'font.dart'
;
import
'graphic_stream.dart'
;
import
'graphics.dart'
;
import
'object.dart'
;
import
'page.dart'
;
import
'point.dart'
;
import
'rect.dart'
;
import
'stream.dart'
;
class
PdfAnnot
extends
PdfObject
{
PdfAnnot
(
this
.
pdfPage
,
this
.
annot
)
...
...
@@ -31,8 +45,8 @@ class PdfAnnot extends PdfObject {
/// Output the annotation
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
annot
.
build
(
pdfPage
,
this
,
params
);
}
}
...
...
pdf/lib/src/arabic.dart
View file @
b533e40
...
...
@@ -14,12 +14,6 @@
* limitations under the License.
*/
// https://github.com/agawish/Better-Arabic-Reshaper/tree/master/src/org/amr/arabic
// http://mpcabd.xyz/python-arabic-text-reshaper/
// https://github.com/Georeactor/alif-toolkit/tree/master/src
part of
pdf
;
/// Arabic shape substitutions functions
class
PdfArabic
{
/// Arabic shape substitutions: char code => (isolated, final, initial, medial).
...
...
@@ -224,7 +218,7 @@ class PdfArabic {
return
_arabicDiacritics
.
containsKey
(
letter
);
}
static
bool
_
isArabicDiacriticValue
(
int
letter
)
{
static
bool
isArabicDiacriticValue
(
int
letter
)
{
return
_arabicDiacritics
.
containsValue
(
letter
);
}
...
...
@@ -240,7 +234,7 @@ class PdfArabic {
final
finalDiacritics
=
<
int
>[];
for
(
var
i
=
0
;
i
<
letters
.
length
;
i
++)
{
if
(
_
isArabicDiacriticValue
(
letters
[
i
]))
{
if
(
isArabicDiacriticValue
(
letters
[
i
]))
{
effectedDiacritics
.
insert
(
0
,
letters
[
i
]);
if
(
tmpDiacritic
.
containsKey
(
letters
[
i
]))
{
tmpDiacritic
=
tmpDiacritic
[
letters
[
i
]];
...
...
pdf/lib/src/array.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
import
'stream.dart'
;
/// An array object
class
PdfArrayObject
extends
PdfObject
{
...
...
@@ -29,8 +32,8 @@ class PdfArrayObject extends PdfObject {
final
PdfArray
array
;
@override
void
_writeContent
(
PdfStream
os
)
{
super
.
_writeContent
(
os
);
void
writeContent
(
PdfStream
os
)
{
super
.
writeContent
(
os
);
array
.
output
(
os
);
os
.
putBytes
(<
int
>[
0x0a
]);
...
...
pdf/lib/src/ascii85.dart
View file @
b533e40
...
...
@@ -14,7 +14,8 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:convert'
;
import
'dart:typed_data'
;
/// Ascii 85 encoder
class
Ascii85Encoder
extends
Converter
<
Uint8List
,
Uint8List
>
{
...
...
pdf/lib/src/border.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'annotation.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
/// Border style
enum
PdfBorderStyle
{
...
...
@@ -58,8 +61,8 @@ class PdfBorder extends PdfObject {
final
List
<
double
>
dash
;
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
params
[
'/S'
]
=
PdfName
(
'/'
+
'SDBIU'
.
substring
(
style
.
index
,
style
.
index
+
1
));
...
...
pdf/lib/src/catalog.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
pdf
;
import
'annotation.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'names.dart'
;
import
'object.dart'
;
import
'outline.dart'
;
import
'page_list.dart'
;
/// Pdf Catalog object
class
PdfCatalog
extends
PdfObject
{
...
...
@@ -41,9 +47,17 @@ class PdfCatalog extends PdfObject {
/// The initial page mode
final
PdfNames
names
;
/// These map the page modes just defined to the pagemodes setting of Pdf.
static
const
List
<
String
>
_PdfPageModes
=
<
String
>[
'/UseNone'
,
'/UseOutlines'
,
'/UseThumbs'
,
'/FullScreen'
];
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
/// the PDF specification version, overrides the header version starting from 1.4
params
[
'/Version'
]
=
PdfName
(
'/
${pdfDocument.version}
'
);
...
...
@@ -59,7 +73,7 @@ class PdfCatalog extends PdfObject {
params
[
'/Names'
]
=
names
.
ref
();
// the /PageMode setting
params
[
'/PageMode'
]
=
PdfName
(
PdfDocument
.
_PdfPageModes
[
pageMode
.
index
]);
params
[
'/PageMode'
]
=
PdfName
(
_PdfPageModes
[
pageMode
.
index
]);
if
(
pdfDocument
.
sign
!=
null
)
{
params
[
'/Perms'
]
=
PdfDict
(<
String
,
PdfDataType
>{
...
...
pdf/lib/src/color.dart
View file @
b533e40
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:math'
as
math
;
/// Represents an RGB color
class
PdfColor
{
...
...
pdf/lib/src/colors.dart
View file @
b533e40
...
...
@@ -14,9 +14,7 @@
* limitations under the License.
*/
// ignore_for_file: public_member_api_docs
part of
pdf
;
import
'color.dart'
;
/// Material design colors
class
PdfColors
{
...
...
pdf/lib/src/data_types.dart
View file @
b533e40
...
...
@@ -14,9 +14,15 @@
* limitations under the License.
*/
// ignore_for_file: avoid_unused_constructor_parameters
import
'dart:convert'
;
import
'dart:typed_data'
;
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'package:utf/utf.dart'
;
import
'color.dart'
;
import
'object.dart'
;
import
'stream.dart'
;
abstract
class
PdfDataType
{
const
PdfDataType
();
...
...
@@ -97,7 +103,7 @@ class PdfString extends PdfDataType {
return
PdfString
(
_string
(
value
),
PdfStringFormat
.
litteral
);
}
factory
PdfString
.
fromStream
(
Pdf
Object
object
,
Pdf
Stream
value
,
factory
PdfString
.
fromStream
(
PdfStream
value
,
[
PdfStringFormat
format
=
PdfStringFormat
.
litteral
])
{
return
PdfString
(
value
.
output
(),
format
);
}
...
...
pdf/lib/src/document.dart
View file @
b533e40
...
...
@@ -14,7 +14,27 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:crypto/crypto.dart'
;
import
'../io/interface.dart'
if
(
dart
.
library
.
io
)
'../io/vm.dart'
if
(
dart
.
library
.
js
)
'../io/js.dart'
;
import
'catalog.dart'
;
import
'encryption.dart'
;
import
'font.dart'
;
import
'graphic_state.dart'
;
import
'info.dart'
;
import
'names.dart'
;
import
'object.dart'
;
import
'outline.dart'
;
import
'output.dart'
;
import
'page.dart'
;
import
'page_list.dart'
;
import
'signature.dart'
;
import
'stream.dart'
;
/// Display hint for the PDF viewer
enum
PdfPageMode
{
...
...
@@ -102,14 +122,6 @@ class PdfDocument {
/// The PDF specification version
final
String
version
=
'1.7'
;
/// These map the page modes just defined to the pagemodes setting of Pdf.
static
const
List
<
String
>
_PdfPageModes
=
<
String
>[
'/UseNone'
,
'/UseOutlines'
,
'/UseThumbs'
,
'/FullScreen'
];
/// This holds the current fonts
final
Set
<
PdfFont
>
fonts
=
<
PdfFont
>{};
...
...
@@ -129,7 +141,7 @@ class PdfDocument {
}
/// Creates a new serial number
int
_
genSerial
()
=>
_objser
++;
int
genSerial
()
=>
_objser
++;
/// This returns a specific page. It's used mainly when using a
/// Serialized template file.
...
...
pdf/lib/src/encryption.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:typed_data'
;
import
'document.dart'
;
import
'object.dart'
;
/// Encryption object
abstract
class
PdfEncryption
extends
PdfObject
{
...
...
pdf/lib/src/exif.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:convert'
;
import
'dart:typed_data'
;
import
'image.dart'
;
/// Jpeg metadata extraction
class
PdfJpegInfo
{
...
...
pdf/lib/src/font.dart
View file @
b533e40
...
...
@@ -14,13 +14,25 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:convert'
;
import
'package:meta/meta.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'font_metrics.dart'
;
import
'object.dart'
;
import
'point.dart'
;
import
'rect.dart'
;
import
'stream.dart'
;
import
'type1_font.dart'
;
import
'type1_fonts.dart'
;
/// Pdf font object
abstract
class
PdfFont
extends
PdfObject
{
/// Constructs a [PdfFont]. This will attempt to map the font from a known
/// font name to that in Pdf, defaulting to Helvetica if not possible.
PdfFont
.
_
create
(
PdfDocument
pdfDocument
,
{
@required
this
.
subtype
})
PdfFont
.
create
(
PdfDocument
pdfDocument
,
{
@required
this
.
subtype
})
:
assert
(
subtype
!=
null
),
super
(
pdfDocument
,
'/Font'
)
{
pdfDocument
.
fonts
.
add
(
this
);
...
...
@@ -28,87 +40,87 @@ abstract class PdfFont extends PdfObject {
/// Monospaced slab serif typeface.
factory
PdfFont
.
courier
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_
create
(
return
PdfType1Font
.
create
(
pdfDocument
,
'Courier'
,
0.910
,
-
0.220
,
const
<
double
>[]);
}
/// Bold monospaced slab serif typeface.
factory
PdfFont
.
courierBold
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_
create
(
return
PdfType1Font
.
create
(
pdfDocument
,
'Courier-Bold'
,
0.910
,
-
0.220
,
const
<
double
>[]);
}
/// Bold and Italic monospaced slab serif typeface.
factory
PdfFont
.
courierBoldOblique
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_
create
(
return
PdfType1Font
.
create
(
pdfDocument
,
'Courier-BoldOblique'
,
0.910
,
-
0.220
,
const
<
double
>[]);
}
/// Italic monospaced slab serif typeface.
factory
PdfFont
.
courierOblique
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_
create
(
return
PdfType1Font
.
create
(
pdfDocument
,
'Courier-Oblique'
,
0.910
,
-
0.220
,
const
<
double
>[]);
}
/// Neo-grotesque design sans-serif typeface
factory
PdfFont
.
helvetica
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Helvetica'
,
0.931
,
-
0.225
,
_helveticaWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Helvetica'
,
0.931
,
-
0.225
,
helveticaWidths
);
}
/// Bold Neo-grotesque design sans-serif typeface
factory
PdfFont
.
helveticaBold
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Helvetica-Bold'
,
0.962
,
-
0.228
,
_helveticaBoldWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Helvetica-Bold'
,
0.962
,
-
0.228
,
helveticaBoldWidths
);
}
/// Bold and Italic Neo-grotesque design sans-serif typeface
factory
PdfFont
.
helveticaBoldOblique
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Helvetica-BoldOblique'
,
0.962
,
-
0.228
,
_helveticaBoldObliqueWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Helvetica-BoldOblique'
,
0.962
,
-
0.228
,
helveticaBoldObliqueWidths
);
}
/// Italic Neo-grotesque design sans-serif typeface
factory
PdfFont
.
helveticaOblique
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Helvetica-Oblique'
,
0.931
,
-
0.225
,
_helveticaObliqueWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Helvetica-Oblique'
,
0.931
,
-
0.225
,
helveticaObliqueWidths
);
}
/// Serif typeface commissioned by the British newspaper The Times
factory
PdfFont
.
times
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Times-Roman'
,
0.898
,
-
0.218
,
_timesWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Times-Roman'
,
0.898
,
-
0.218
,
timesWidths
);
}
/// Bold serif typeface commissioned by the British newspaper The Times
factory
PdfFont
.
timesBold
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Times-Bold'
,
0.935
,
-
0.218
,
_timesBoldWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Times-Bold'
,
0.935
,
-
0.218
,
timesBoldWidths
);
}
/// Bold and Italic serif typeface commissioned by the British newspaper The Times
factory
PdfFont
.
timesBoldItalic
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Times-BoldItalic'
,
0.921
,
-
0.218
,
_timesBoldItalicWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Times-BoldItalic'
,
0.921
,
-
0.218
,
timesBoldItalicWidths
);
}
/// Italic serif typeface commissioned by the British newspaper The Times
factory
PdfFont
.
timesItalic
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Times-Italic'
,
0.883
,
-
0.217
,
_timesItalicWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Times-Italic'
,
0.883
,
-
0.217
,
timesItalicWidths
);
}
/// Complete unaccented serif Greek alphabet (upper and lower case) and a
/// selection of commonly used mathematical symbols.
factory
PdfFont
.
symbol
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'Symbol'
,
1.010
,
-
0.293
,
_symbolWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'Symbol'
,
1.010
,
-
0.293
,
symbolWidths
);
}
/// Hermann Zapf ornament glyphs or spacers, often employed to create box frames
factory
PdfFont
.
zapfDingbats
(
PdfDocument
pdfDocument
)
{
return
PdfType1Font
.
_create
(
pdfDocument
,
'ZapfDingbats'
,
0.820
,
-
0.143
,
_zapfDingbatsWidths
);
return
PdfType1Font
.
create
(
pdfDocument
,
'ZapfDingbats'
,
0.820
,
-
0.143
,
zapfDingbatsWidths
);
}
static
const
String
_cannotDecodeMessage
=
...
...
@@ -142,8 +154,8 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management
int
get
unitsPerEm
;
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
params
[
'/Subtype'
]
=
PdfName
(
subtype
);
params
[
'/Name'
]
=
PdfName
(
name
);
...
...
pdf/lib/src/font_descriptor.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'object.dart'
;
import
'object_stream.dart'
;
import
'ttffont.dart'
;
/// Font descriptor object
class
PdfFontDescriptor
extends
PdfObject
{
...
...
@@ -33,8 +36,8 @@ class PdfFontDescriptor extends PdfObject {
final
PdfTtfFont
ttfFont
;
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
params
[
'/FontName'
]
=
PdfName
(
'/'
+
ttfFont
.
fontName
);
params
[
'/FontFile2'
]
=
file
.
ref
();
...
...
pdf/lib/src/font_metrics.dart
View file @
b533e40
...
...
@@ -14,7 +14,11 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'rect.dart'
;
/// Describe dimensions for glyphs in a font
@immutable
...
...
pdf/lib/src/formxobject.dart
View file @
b533e40
...
...
@@ -14,7 +14,12 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:vector_math/vector_math_64.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'font.dart'
;
import
'xobject.dart'
;
/// Form XObject
class
PdfFormXObject
extends
PdfXObject
{
...
...
@@ -38,8 +43,8 @@ class PdfFormXObject extends PdfXObject {
}
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
// This holds any resources for this FormXObject
final
resources
=
PdfDict
();
...
...
pdf/lib/src/function.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'color.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
import
'object_stream.dart'
;
abstract
class
PdfBaseFunction
extends
PdfObject
{
PdfBaseFunction
(
PdfDocument
pdfDocument
)
:
super
(
pdfDocument
);
...
...
@@ -29,7 +35,7 @@ class PdfFunction extends PdfObjectStream implements PdfBaseFunction {
final
List
<
PdfColor
>
colors
;
@override
void
_
prepare
()
{
void
prepare
()
{
for
(
final
color
in
colors
)
{
buf
.
putBytes
(<
int
>[
(
color
.
red
*
255.0
).
round
()
&
0xff
,
...
...
@@ -38,7 +44,7 @@ class PdfFunction extends PdfObjectStream implements PdfBaseFunction {
]);
}
super
.
_
prepare
();
super
.
prepare
();
params
[
'/FunctionType'
]
=
const
PdfNum
(
0
);
params
[
'/BitsPerSample'
]
=
const
PdfNum
(
8
);
...
...
@@ -69,8 +75,8 @@ class PdfStitchingFunction extends PdfBaseFunction {
final
double
domainEnd
;
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
params
[
'/FunctionType'
]
=
const
PdfNum
(
3
);
params
[
'/Functions'
]
=
PdfArray
.
fromObjects
(
functions
);
...
...
pdf/lib/src/graphic_state.dart
View file @
b533e40
...
...
@@ -16,7 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
/// Graphic state
@immutable
...
...
@@ -71,8 +75,8 @@ class PdfGraphicStates extends PdfObject {
}
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
for
(
var
index
=
0
;
index
<
_states
.
length
;
index
++)
{
params
[
'
$_prefix$index
'
]
=
_states
[
index
].
_output
();
...
...
pdf/lib/src/graphic_stream.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'font.dart'
;
import
'graphic_state.dart'
;
import
'object.dart'
;
import
'shading.dart'
;
import
'xobject.dart'
;
/// Helper functions for graphic objects
mixin
PdfGraphicStream
on
PdfObject
{
...
...
@@ -75,8 +81,8 @@ mixin PdfGraphicStream on PdfObject {
}
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
// This holds any resources for this page
final
resources
=
PdfDict
();
...
...
pdf/lib/src/graphics.dart
View file @
b533e40
...
...
@@ -14,7 +14,22 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:collection'
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:path_parsing/path_parsing.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'color.dart'
;
import
'data_types.dart'
;
import
'font.dart'
;
import
'graphic_state.dart'
;
import
'graphic_stream.dart'
;
import
'image.dart'
;
import
'page.dart'
;
import
'shading.dart'
;
import
'stream.dart'
;
/// Shape to be used at the corners of paths that are stroked
enum
PdfLineJoin
{
...
...
pdf/lib/src/image.dart
View file @
b533e40
...
...
@@ -14,7 +14,15 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:typed_data'
;
import
'package:image/image.dart'
as
im
;
import
'package:meta/meta.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'exif.dart'
;
import
'xobject.dart'
;
/// Represents the position of the first pixel in the data stream
/// This corresponds to the exif orientations
...
...
pdf/lib/src/info.dart
View file @
b533e40
...
...
@@ -14,7 +14,9 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
/// Information object
class
PdfInfo
extends
PdfObject
{
...
...
pdf/lib/src/names.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
import
'page.dart'
;
/// Pdf Name object
class
PdfNames
extends
PdfObject
{
...
...
@@ -46,8 +49,8 @@ class PdfNames extends PdfObject {
}
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
final
dests
=
PdfArray
();
...
...
pdf/lib/src/object.dart
View file @
b533e40
...
...
@@ -14,7 +14,11 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'stream.dart'
;
/// Base Object used in the PDF file
class
PdfObject
{
...
...
@@ -24,7 +28,7 @@ class PdfObject {
this
.
pdfDocument
,
[
String
type
,
])
:
assert
(
pdfDocument
!=
null
),
objser
=
pdfDocument
.
_
genSerial
()
{
objser
=
pdfDocument
.
genSerial
()
{
if
(
type
!=
null
)
{
params
[
'/Type'
]
=
PdfName
(
type
);
}
...
...
@@ -45,16 +49,16 @@ class PdfObject {
final
PdfDocument
pdfDocument
;
/// Writes the object to the output stream.
void
_write
(
PdfStream
os
)
{
_prepare
();
void
write
(
PdfStream
os
)
{
prepare
();
_writeStart
(
os
);
_
writeContent
(
os
);
writeContent
(
os
);
_writeEnd
(
os
);
}
/// Prepare the object to be written to the stream
@mustCallSuper
void
_
prepare
()
{}
void
prepare
()
{}
/// The write method should call this before writing anything to the
/// OutputStream. This will send the standard header for each object.
...
...
@@ -62,7 +66,7 @@ class PdfObject {
os
.
putString
(
'
$objser
$objgen
obj
\n
'
);
}
void
_
writeContent
(
PdfStream
os
)
{
void
writeContent
(
PdfStream
os
)
{
if
(
params
.
isNotEmpty
)
{
params
.
output
(
os
);
os
.
putString
(
'
\n
'
);
...
...
pdf/lib/src/object_stream.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:typed_data'
;
import
'ascii85.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
import
'stream.dart'
;
/// Stream Object
class
PdfObjectStream
extends
PdfObject
{
...
...
@@ -34,8 +40,8 @@ class PdfObjectStream extends PdfObject {
Uint8List
_data
;
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
if
(
params
.
containsKey
(
'/Filter'
)
&&
_data
==
null
)
{
// The data is already in the right format
...
...
@@ -67,8 +73,8 @@ class PdfObjectStream extends PdfObject {
}
@override
void
_writeContent
(
PdfStream
os
)
{
super
.
_writeContent
(
os
);
void
writeContent
(
PdfStream
os
)
{
super
.
writeContent
(
os
);
os
.
putString
(
'stream
\n
'
);
os
.
putBytes
(
_data
);
...
...
pdf/lib/src/outline.dart
View file @
b533e40
...
...
@@ -14,7 +14,12 @@
* limitations under the License.
*/
part of
pdf
;
import
'color.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
import
'page.dart'
;
import
'rect.dart'
;
/// Outline mode
enum
PdfOutlineMode
{
...
...
@@ -96,8 +101,8 @@ class PdfOutline extends PdfObject {
}
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
// These are for kids only
if
(
parent
!=
null
)
{
...
...
pdf/lib/src/output.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
pdf
;
import
'catalog.dart'
;
import
'data_types.dart'
;
import
'encryption.dart'
;
import
'info.dart'
;
import
'object.dart'
;
import
'signature.dart'
;
import
'stream.dart'
;
import
'xref.dart'
;
/// PDF document writer
class
PdfOutput
{
...
...
@@ -61,7 +68,7 @@ class PdfOutput {
}
offsets
.
add
(
PdfXref
(
ob
.
objser
,
os
.
offset
));
ob
.
_
write
(
os
);
ob
.
write
(
os
);
}
/// This closes the Stream, writing the xref table
...
...
@@ -138,7 +145,7 @@ class PdfOutput {
os
.
putString
(
'
\n
startxref
\n
$xref
\n
%%EOF
\n
'
);
if
(
signatureID
!=
null
)
{
signatureID
.
_
writeSignature
(
os
);
signatureID
.
writeSignature
(
os
);
}
}
...
...
pdf/lib/src/page.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
pdf
;
import
'annotation.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'graphic_stream.dart'
;
import
'graphics.dart'
;
import
'object.dart'
;
import
'object_stream.dart'
;
import
'page_format.dart'
;
/// Page object, which will hold any contents for this page.
class
PdfPage
extends
PdfObject
with
PdfGraphicStream
{
...
...
@@ -55,8 +62,8 @@ class PdfPage extends PdfObject with PdfGraphicStream {
}
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
// the /Parent pages object
params
[
'/Parent'
]
=
pdfDocument
.
pdfPageList
.
ref
();
...
...
pdf/lib/src/page_format.dart
View file @
b533e40
...
...
@@ -14,7 +14,9 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:math'
as
math
;
import
'point.dart'
;
class
PdfPageFormat
{
const
PdfPageFormat
(
this
.
width
,
this
.
height
,
...
...
pdf/lib/src/page_list.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
import
'page.dart'
;
/// PdfPageList object
class
PdfPageList
extends
PdfObject
{
...
...
@@ -28,8 +31,8 @@ class PdfPageList extends PdfObject {
PdfPage
getPage
(
int
page
)
=>
pages
[
page
];
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
params
[
'/Kids'
]
=
PdfArray
.
fromObjects
(
pages
);
params
[
'/Count'
]
=
PdfNum
(
pages
.
length
);
...
...
pdf/lib/src/point.dart
View file @
b533e40
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
@immutable
class
PdfPoint
{
...
...
pdf/lib/src/rect.dart
View file @
b533e40
...
...
@@ -14,7 +14,9 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'point.dart'
;
@immutable
class
PdfRect
{
...
...
pdf/lib/src/shading.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'function.dart'
;
import
'object.dart'
;
import
'point.dart'
;
import
'rect.dart'
;
enum
PdfShadingType
{
axial
,
radial
}
...
...
@@ -60,8 +67,8 @@ class PdfShading extends PdfObject {
final
double
radius1
;
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
params
[
'/ShadingType'
]
=
PdfNum
(
shadingType
.
index
+
2
);
if
(
boundingBox
!=
null
)
{
...
...
pdf/lib/src/signature.dart
View file @
b533e40
...
...
@@ -14,7 +14,12 @@
* limitations under the License.
*/
part of
pdf
;
import
'package:meta/meta.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object.dart'
;
import
'stream.dart'
;
enum
PdfSigFlags
{
signaturesExist
,
appendOnly
}
...
...
@@ -39,15 +44,15 @@ class PdfSignature extends PdfObject {
int
_offsetEnd
;
@override
void
_
write
(
PdfStream
os
)
{
void
write
(
PdfStream
os
)
{
crypto
.
preSign
(
this
,
params
);
_offsetStart
=
os
.
offset
+
'
$objser
$objgen
obj
\n
'
.
length
;
super
.
_
write
(
os
);
super
.
write
(
os
);
_offsetEnd
=
os
.
offset
;
}
void
_
writeSignature
(
PdfStream
os
)
{
void
writeSignature
(
PdfStream
os
)
{
assert
(
_offsetStart
!=
null
&&
_offsetEnd
!=
null
,
'Must reserve the object space before signing the document'
);
...
...
pdf/lib/src/stream.dart
View file @
b533e40
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:typed_data'
;
class
PdfStream
{
static
const
int
_grow
=
65536
;
...
...
pdf/lib/src/ttf_parser.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:convert'
;
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:meta/meta.dart'
;
import
'package:utf/utf.dart'
;
import
'font_metrics.dart'
;
@immutable
class
TtfGlyphInfo
{
...
...
pdf/lib/src/ttf_writer.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'ttf_parser.dart'
;
/// Generate a TTF font copy with the minimal number of glyph to embedd
/// into the PDF document
...
...
pdf/lib/src/ttffont.dart
View file @
b533e40
...
...
@@ -14,13 +14,27 @@
* limitations under the License.
*/
part of
pdf
;
import
'dart:convert'
;
import
'dart:typed_data'
;
import
'arabic.dart'
;
import
'array.dart'
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'font.dart'
;
import
'font_descriptor.dart'
;
import
'font_metrics.dart'
;
import
'object_stream.dart'
;
import
'stream.dart'
;
import
'ttf_parser.dart'
;
import
'ttf_writer.dart'
;
import
'unicode_cmap.dart'
;
class
PdfTtfFont
extends
PdfFont
{
/// Constructs a [PdfTtfFont]
PdfTtfFont
(
PdfDocument
pdfDocument
,
ByteData
bytes
,
{
bool
protect
=
false
})
:
font
=
TtfParser
(
bytes
),
super
.
_
create
(
pdfDocument
,
subtype:
'/TrueType'
)
{
super
.
create
(
pdfDocument
,
subtype:
'/TrueType'
)
{
file
=
PdfObjectStream
(
pdfDocument
,
isBinary:
true
);
unicodeCMap
=
PdfUnicodeCmap
(
pdfDocument
,
protect
);
descriptor
=
PdfFontDescriptor
(
this
,
file
);
...
...
@@ -60,7 +74,7 @@ class PdfTtfFont extends PdfFont {
return
PdfFontMetrics
.
zero
;
}
if
(
PdfArabic
.
_
isArabicDiacriticValue
(
charCode
))
{
if
(
PdfArabic
.
isArabicDiacriticValue
(
charCode
))
{
final
metric
=
font
.
glyphInfoMap
[
g
]
??
PdfFontMetrics
.
zero
;
return
metric
.
copyWith
(
advanceWidth:
0
);
}
...
...
@@ -130,8 +144,8 @@ class PdfTtfFont extends PdfFont {
}
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
if
(
font
.
unicode
)
{
_buildType0
(
params
);
...
...
pdf/lib/src/type1_font.dart
View file @
b533e40
...
...
@@ -14,7 +14,11 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'font.dart'
;
import
'font_metrics.dart'
;
import
'ttffont.dart'
;
/// Type 1 font object.
/// this font is a default PDF font available in all PDF readers,
...
...
@@ -26,14 +30,14 @@ part of pdf;
/// see https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management
class
PdfType1Font
extends
PdfFont
{
/// Constructs a [PdfTtfFont]
PdfType1Font
.
_
create
(
PdfDocument
pdfDocument
,
this
.
fontName
,
this
.
ascent
,
PdfType1Font
.
create
(
PdfDocument
pdfDocument
,
this
.
fontName
,
this
.
ascent
,
this
.
descent
,
this
.
widths
)
:
assert
(()
{
print
(
'
$fontName
has no Unicode support see https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management'
);
return
true
;
}()),
super
.
_
create
(
pdfDocument
,
subtype:
'/Type1'
);
super
.
create
(
pdfDocument
,
subtype:
'/Type1'
);
@override
final
String
fontName
;
...
...
@@ -51,8 +55,8 @@ class PdfType1Font extends PdfFont {
final
List
<
double
>
widths
;
@override
void
_prepare
()
{
super
.
_prepare
();
void
prepare
()
{
super
.
prepare
();
params
[
'/BaseFont'
]
=
PdfName
(
'/'
+
fontName
);
}
...
...
pdf/lib/src/type1_fonts.dart
View file @
b533e40
...
...
@@ -14,9 +14,7 @@
* limitations under the License.
*/
part of
pdf
;
const
List
<
double
>
_helveticaWidths
=
<
double
>[
const
List
<
double
>
helveticaWidths
=
<
double
>[
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
//
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
//
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
0.500
,
//
...
...
@@ -45,7 +43,7 @@ const List<double> _helveticaWidths = <double>[
0.500
];
const
List
<
double
>
_
helveticaBoldWidths
=
<
double
>[
const
List
<
double
>
helveticaBoldWidths
=
<
double
>[
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
...
...
@@ -74,7 +72,7 @@ const List<double> _helveticaBoldWidths = <double>[
0.556
];
const
List
<
double
>
_
helveticaBoldObliqueWidths
=
<
double
>[
const
List
<
double
>
helveticaBoldObliqueWidths
=
<
double
>[
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
...
...
@@ -103,7 +101,7 @@ const List<double> _helveticaBoldObliqueWidths = <double>[
0.556
];
const
List
<
double
>
_
helveticaObliqueWidths
=
<
double
>[
const
List
<
double
>
helveticaObliqueWidths
=
<
double
>[
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
0.278
,
//
...
...
@@ -132,7 +130,7 @@ const List<double> _helveticaObliqueWidths = <double>[
0.500
];
const
List
<
double
>
_
timesWidths
=
<
double
>[
const
List
<
double
>
timesWidths
=
<
double
>[
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
...
...
@@ -161,7 +159,7 @@ const List<double> _timesWidths = <double>[
0.500
,
0.500
,
0.500
,
0.500
];
const
List
<
double
>
_
timesBoldWidths
=
<
double
>[
const
List
<
double
>
timesBoldWidths
=
<
double
>[
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
...
...
@@ -189,7 +187,7 @@ const List<double> _timesBoldWidths = <double>[
0.500
,
0.570
,
0.500
,
0.556
,
0.556
,
0.556
,
0.556
,
0.500
,
0.556
,
0.500
];
const
List
<
double
>
_
timesBoldItalicWidths
=
<
double
>[
const
List
<
double
>
timesBoldItalicWidths
=
<
double
>[
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
...
...
@@ -218,7 +216,7 @@ const List<double> _timesBoldItalicWidths = <double>[
0.556
,
0.444
,
0.500
,
0.444
];
const
List
<
double
>
_
timesItalicWidths
=
<
double
>[
const
List
<
double
>
timesItalicWidths
=
<
double
>[
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
0.250
,
//
...
...
@@ -247,7 +245,7 @@ const List<double> _timesItalicWidths = <double>[
0.500
,
0.500
,
0.444
,
0.500
,
0.444
];
const
List
<
double
>
_
symbolWidths
=
<
double
>[
const
List
<
double
>
symbolWidths
=
<
double
>[
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
//
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
//
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
0.587
,
//
...
...
@@ -276,7 +274,7 @@ const List<double> _symbolWidths = <double>[
0.384
,
0.494
,
0.494
,
0.494
,
0.587
];
const
List
<
double
>
_
zapfDingbatsWidths
=
<
double
>[
const
List
<
double
>
zapfDingbatsWidths
=
<
double
>[
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
//
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
//
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
0.746
,
//
...
...
pdf/lib/src/unicode_cmap.dart
View file @
b533e40
...
...
@@ -14,7 +14,8 @@
* limitations under the License.
*/
part of
pdf
;
import
'document.dart'
;
import
'object_stream.dart'
;
/// Unicode character map object
class
PdfUnicodeCmap
extends
PdfObjectStream
{
...
...
@@ -28,7 +29,7 @@ class PdfUnicodeCmap extends PdfObjectStream {
final
bool
protect
;
@override
void
_
prepare
()
{
void
prepare
()
{
if
(
protect
)
{
cmap
.
fillRange
(
1
,
cmap
.
length
,
0x20
);
}
...
...
@@ -62,6 +63,6 @@ class PdfUnicodeCmap extends PdfObjectStream {
'CMapName currentdict /CMap defineresource pop
\n
'
'end
\n
'
'end'
);
super
.
_
prepare
();
super
.
prepare
();
}
}
...
...
pdf/lib/src/xobject.dart
View file @
b533e40
...
...
@@ -14,7 +14,9 @@
* limitations under the License.
*/
part of
pdf
;
import
'data_types.dart'
;
import
'document.dart'
;
import
'object_stream.dart'
;
class
PdfXObject
extends
PdfObjectStream
{
PdfXObject
(
PdfDocument
pdfDocument
,
String
subtype
,
{
bool
isBinary
=
false
})
...
...
pdf/lib/src/xref.dart
View file @
b533e40
...
...
@@ -14,8 +14,6 @@
* limitations under the License.
*/
part of
pdf
;
/// Cross-reference for a Pdf Object
class
PdfXref
{
/// Creates a cross-reference for a Pdf Object
...
...
pdf/lib/widgets.dart
View file @
b533e40
...
...
@@ -14,54 +14,41 @@
* limitations under the License.
*/
library
widget
;
import
'dart:collection'
;
import
'dart:convert'
;
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:barcode/barcode.dart'
;
import
'package:image/image.dart'
as
im
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
export
'package:barcode/barcode.dart'
;
part
'widgets/annotations.dart'
;
part
'widgets/barcode.dart'
;
part
'widgets/basic.dart'
;
part
'widgets/chart/bar_chart.dart'
;
part
'widgets/chart/chart.dart'
;
part
'widgets/chart/grid_axis.dart'
;
part
'widgets/chart/grid_cartesian.dart'
;
part
'widgets/chart/legend.dart'
;
part
'widgets/chart/line_chart.dart'
;
part
'widgets/clip.dart'
;
part
'widgets/container.dart'
;
part
'widgets/content.dart'
;
part
'widgets/decoration.dart'
;
part
'widgets/document.dart'
;
part
'widgets/flex.dart'
;
part
'widgets/font.dart'
;
part
'widgets/forms.dart'
;
part
'widgets/geometry.dart'
;
part
'widgets/grid_view.dart'
;
part
'widgets/icon.dart'
;
part
'widgets/image.dart'
;
part
'widgets/image_provider.dart'
;
part
'widgets/multi_page.dart'
;
part
'widgets/page.dart'
;
part
'widgets/page_theme.dart'
;
part
'widgets/partitions.dart'
;
part
'widgets/placeholders.dart'
;
part
'widgets/progress.dart'
;
part
'widgets/qrcode.dart'
;
part
'widgets/stack.dart'
;
part
'widgets/table.dart'
;
part
'widgets/text.dart'
;
part
'widgets/text_style.dart'
;
part
'widgets/theme.dart'
;
part
'widgets/widget.dart'
;
part
'widgets/wrap.dart'
;
export
'widgets/annotations.dart'
;
export
'widgets/barcode.dart'
;
export
'widgets/basic.dart'
;
export
'widgets/chart/bar_chart.dart'
;
export
'widgets/chart/chart.dart'
;
export
'widgets/chart/grid_axis.dart'
;
export
'widgets/chart/grid_cartesian.dart'
;
export
'widgets/chart/legend.dart'
;
export
'widgets/chart/line_chart.dart'
;
export
'widgets/clip.dart'
;
export
'widgets/container.dart'
;
export
'widgets/content.dart'
;
export
'widgets/decoration.dart'
;
export
'widgets/document.dart'
;
export
'widgets/flex.dart'
;
export
'widgets/font.dart'
;
export
'widgets/forms.dart'
;
export
'widgets/geometry.dart'
;
export
'widgets/grid_view.dart'
;
export
'widgets/icon.dart'
;
export
'widgets/image.dart'
;
export
'widgets/image_provider.dart'
;
export
'widgets/multi_page.dart'
;
export
'widgets/page.dart'
;
export
'widgets/page_theme.dart'
;
export
'widgets/partitions.dart'
;
export
'widgets/placeholders.dart'
;
export
'widgets/progress.dart'
;
export
'widgets/qrcode.dart'
;
export
'widgets/stack.dart'
;
export
'widgets/table.dart'
;
export
'widgets/text.dart'
;
export
'widgets/text_style.dart'
;
export
'widgets/theme.dart'
;
export
'widgets/widget.dart'
;
export
'widgets/wrap.dart'
;
...
...
pdf/lib/widgets/annotations.dart
View file @
b533e40
...
...
@@ -14,7 +14,15 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic.dart'
;
import
'geometry.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
class
Anchor
extends
SingleChildWidget
{
Anchor
({
...
...
pdf/lib/widgets/barcode.dart
View file @
b533e40
...
...
@@ -14,7 +14,21 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:convert'
;
import
'dart:typed_data'
;
import
'package:barcode/barcode.dart'
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'basic.dart'
;
import
'container.dart'
;
import
'decoration.dart'
;
import
'font.dart'
;
import
'geometry.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
class
_BarcodeWidget
extends
Widget
{
_BarcodeWidget
({
...
...
pdf/lib/widgets/basic.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'container.dart'
;
import
'decoration.dart'
;
import
'geometry.dart'
;
import
'widget.dart'
;
enum
BoxFit
{
fill
,
contain
,
cover
,
fitWidth
,
fitHeight
,
none
,
scaleDown
}
...
...
pdf/lib/widgets/chart/bar_chart.dart
View file @
b533e40
...
...
@@ -14,7 +14,15 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'../flex.dart'
;
import
'../geometry.dart'
;
import
'../widget.dart'
;
import
'chart.dart'
;
import
'grid_cartesian.dart'
;
import
'line_chart.dart'
;
class
BarDataSet
extends
Dataset
{
BarDataSet
({
...
...
pdf/lib/widgets/chart/chart.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'../container.dart'
;
import
'../decoration.dart'
;
import
'../flex.dart'
;
import
'../geometry.dart'
;
import
'../stack.dart'
;
import
'../widget.dart'
;
/// This widget is in preview and the API is subject to change
class
Chart
extends
Widget
implements
Inherited
{
...
...
pdf/lib/widgets/chart/grid_axis.dart
View file @
b533e40
...
...
@@ -14,7 +14,17 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:pdf/pdf.dart'
;
import
'../flex.dart'
;
import
'../geometry.dart'
;
import
'../text_style.dart'
;
import
'../theme.dart'
;
import
'../widget.dart'
;
import
'chart.dart'
;
import
'grid_cartesian.dart'
;
typedef
GridAxisFormat
=
String
Function
(
num
value
);
...
...
@@ -53,7 +63,7 @@ abstract class GridAxis extends Widget {
final
double
margin
;
double
_
crossAxisPosition
=
0
;
double
crossAxisPosition
=
0
;
double
_textMargin
;
...
...
@@ -173,7 +183,7 @@ class FixedAxis<T extends num> extends GridAxis {
double
toChart
(
num
input
)
{
final
offset
=
transfer
(
values
.
first
);
final
total
=
transfer
(
values
.
last
)
-
offset
;
final
start
=
_
crossAxisPosition
+
_marginStart
;
final
start
=
crossAxisPosition
+
_marginStart
;
switch
(
direction
)
{
case
Axis
.
horizontal
:
return
box
.
left
+
...
...
@@ -219,7 +229,7 @@ class FixedAxis<T extends num> extends GridAxis {
_axisTick
??=
false
;
final
minStart
=
metricsFirst
.
maxWidth
/
2
;
_marginEnd
=
math
.
max
(
_marginEnd
,
metrics
.
maxWidth
/
2
);
_crossAxisPosition
=
math
.
max
(
_
crossAxisPosition
,
minStart
);
crossAxisPosition
=
math
.
max
(
crossAxisPosition
,
minStart
);
axisPosition
=
math
.
max
(
axisPosition
,
maxHeight
+
_textMargin
);
box
=
PdfRect
(
0
,
0
,
size
.
x
,
axisPosition
);
break
;
...
...
@@ -229,7 +239,7 @@ class FixedAxis<T extends num> extends GridAxis {
_marginEnd
=
math
.
max
(
_marginEnd
,
metrics
.
maxHeight
/
2
);
final
minStart
=
metricsFirst
.
maxHeight
/
2
;
_marginEnd
=
math
.
max
(
_marginEnd
,
metrics
.
maxWidth
/
2
);
_crossAxisPosition
=
math
.
max
(
_
crossAxisPosition
,
minStart
);
crossAxisPosition
=
math
.
max
(
crossAxisPosition
,
minStart
);
axisPosition
=
math
.
max
(
axisPosition
,
maxWidth
+
_textMargin
);
box
=
PdfRect
(
0
,
0
,
axisPosition
,
size
.
y
);
break
;
...
...
@@ -239,13 +249,13 @@ class FixedAxis<T extends num> extends GridAxis {
void
_drawYValues
(
Context
context
)
{
context
.
canvas
..
moveTo
(
axisPosition
,
box
.
top
)
..
lineTo
(
axisPosition
,
box
.
bottom
+
_
crossAxisPosition
);
..
lineTo
(
axisPosition
,
box
.
bottom
+
crossAxisPosition
);
if
(
_axisTick
&&
_textMargin
>
0
)
{
context
.
canvas
..
moveTo
(
axisPosition
,
box
.
bottom
+
_
crossAxisPosition
)
..
moveTo
(
axisPosition
,
box
.
bottom
+
crossAxisPosition
)
..
lineTo
(
axisPosition
-
_textMargin
/
2
,
box
.
bottom
+
_
crossAxisPosition
);
axisPosition
-
_textMargin
/
2
,
box
.
bottom
+
crossAxisPosition
);
}
if
(
ticks
&&
_textMargin
>
0
)
{
...
...
@@ -284,13 +294,13 @@ class FixedAxis<T extends num> extends GridAxis {
void
_drawXValues
(
Context
context
)
{
context
.
canvas
..
moveTo
(
box
.
left
+
_
crossAxisPosition
,
axisPosition
)
..
moveTo
(
box
.
left
+
crossAxisPosition
,
axisPosition
)
..
lineTo
(
box
.
right
,
axisPosition
);
if
(
_axisTick
&&
_textMargin
>
0
)
{
context
.
canvas
..
moveTo
(
box
.
left
+
_crossAxisPosition
,
axisPosition
)
..
lineTo
(
box
.
left
+
_crossAxisPosition
,
axisPosition
-
_textMargin
);
..
moveTo
(
box
.
left
+
crossAxisPosition
,
axisPosition
)
..
lineTo
(
box
.
left
+
crossAxisPosition
,
axisPosition
-
_textMargin
);
}
if
(
ticks
&&
_textMargin
>
0
)
{
...
...
@@ -379,8 +389,8 @@ class FixedAxis<T extends num> extends GridAxis {
case
Axis
.
vertical
:
context
.
canvas
..
setFillColor
(
PdfColors
.
grey300
)
..
drawRect
(
box
.
x
,
box
.
y
+
_crossAxisPosition
,
box
.
width
,
box
.
height
-
_crossAxisPosition
)
..
drawRect
(
box
.
x
,
box
.
y
+
crossAxisPosition
,
box
.
width
,
box
.
height
-
crossAxisPosition
)
..
fillPath
();
break
;
}
...
...
pdf/lib/widgets/chart/grid_cartesian.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'../flex.dart'
;
import
'../geometry.dart'
;
import
'../widget.dart'
;
import
'chart.dart'
;
import
'grid_axis.dart'
;
class
CartesianGrid
extends
ChartGrid
{
CartesianGrid
({
...
...
@@ -41,18 +50,18 @@ class CartesianGrid extends ChartGrid {
// In simple conditions, this loop will run only 2 times.
var
count
=
5
;
while
(
count
--
>
0
)
{
_xAxis
.
_
crossAxisPosition
=
_yAxis
.
axisPosition
;
_xAxis
.
crossAxisPosition
=
_yAxis
.
axisPosition
;
_xAxis
.
axisPosition
=
math
.
max
(
_xAxis
.
axisPosition
,
_yAxis
.
_
crossAxisPosition
);
math
.
max
(
_xAxis
.
axisPosition
,
_yAxis
.
crossAxisPosition
);
_xAxis
.
layout
(
context
,
constraints
);
assert
(
_xAxis
.
box
!=
null
);
_yAxis
.
_
crossAxisPosition
=
_xAxis
.
axisPosition
;
_yAxis
.
crossAxisPosition
=
_xAxis
.
axisPosition
;
_yAxis
.
axisPosition
=
math
.
max
(
_yAxis
.
axisPosition
,
_xAxis
.
_
crossAxisPosition
);
math
.
max
(
_yAxis
.
axisPosition
,
_xAxis
.
crossAxisPosition
);
_yAxis
.
layout
(
context
,
constraints
);
assert
(
_yAxis
.
box
!=
null
);
if
(
_yAxis
.
_crossAxisPosition
==
_xAxis
.
axisPosition
&&
_xAxis
.
_crossAxisPosition
==
_yAxis
.
axisPosition
)
{
if
(
_yAxis
.
crossAxisPosition
==
_xAxis
.
axisPosition
&&
_xAxis
.
crossAxisPosition
==
_yAxis
.
axisPosition
)
{
break
;
}
}
...
...
pdf/lib/widgets/chart/legend.dart
View file @
b533e40
...
...
@@ -14,7 +14,19 @@
* limitations under the License.
*/
part of
widget
;
import
'package:pdf/pdf.dart'
;
import
'../basic.dart'
;
import
'../container.dart'
;
import
'../decoration.dart'
;
import
'../flex.dart'
;
import
'../geometry.dart'
;
import
'../text.dart'
;
import
'../text_style.dart'
;
import
'../theme.dart'
;
import
'../widget.dart'
;
import
'../wrap.dart'
;
import
'chart.dart'
;
class
ChartLegend
extends
StatelessWidget
{
ChartLegend
({
...
...
pdf/lib/widgets/chart/line_chart.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'../geometry.dart'
;
import
'../widget.dart'
;
import
'chart.dart'
;
import
'grid_cartesian.dart'
;
class
LineChartValue
extends
ChartValue
{
const
LineChartValue
(
this
.
x
,
this
.
y
);
...
...
pdf/lib/widgets/clip.dart
View file @
b533e40
...
...
@@ -14,7 +14,10 @@
* limitations under the License.
*/
part of
widget
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'widget.dart'
;
class
ClipRect
extends
SingleChildWidget
{
ClipRect
({
Widget
child
})
:
super
(
child:
child
);
...
...
pdf/lib/widgets/container.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic.dart'
;
import
'decoration.dart'
;
import
'geometry.dart'
;
import
'widget.dart'
;
class
DecoratedBox
extends
SingleChildWidget
{
DecoratedBox
(
...
...
pdf/lib/widgets/content.dart
View file @
b533e40
...
...
@@ -14,7 +14,21 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'annotations.dart'
;
import
'basic.dart'
;
import
'container.dart'
;
import
'decoration.dart'
;
import
'flex.dart'
;
import
'geometry.dart'
;
import
'text.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
class
Header
extends
StatelessWidget
{
Header
({
...
...
pdf/lib/widgets/decoration.dart
View file @
b533e40
...
...
@@ -14,7 +14,17 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:image/image.dart'
as
im
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic.dart'
;
import
'geometry.dart'
;
import
'image_provider.dart'
;
import
'widget.dart'
;
enum
DecorationPosition
{
background
,
foreground
}
...
...
pdf/lib/widgets/document.dart
View file @
b533e40
...
...
@@ -14,7 +14,12 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:typed_data'
;
import
'package:pdf/pdf.dart'
;
import
'page.dart'
;
import
'theme.dart'
;
class
Document
{
Document
(
...
...
pdf/lib/widgets/flex.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic.dart'
;
import
'geometry.dart'
;
import
'multi_page.dart'
;
import
'widget.dart'
;
enum
FlexFit
{
tight
,
...
...
pdf/lib/widgets/font.dart
View file @
b533e40
...
...
@@ -14,7 +14,12 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:typed_data'
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'widget.dart'
;
enum
Type1Fonts
{
courier
,
...
...
pdf/lib/widgets/forms.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'container.dart'
;
import
'decoration.dart'
;
import
'geometry.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
class
Checkbox
extends
SingleChildWidget
{
Checkbox
({
...
...
pdf/lib/widgets/geometry.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic.dart'
;
@immutable
class
BoxConstraints
{
...
...
pdf/lib/widgets/grid_view.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'flex.dart'
;
import
'geometry.dart'
;
import
'multi_page.dart'
;
import
'widget.dart'
;
class
_GridViewContext
extends
WidgetContext
{
int
firstChild
=
0
;
...
...
pdf/lib/widgets/icon.dart
View file @
b533e40
...
...
@@ -14,7 +14,17 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic.dart'
;
import
'font.dart'
;
import
'geometry.dart'
;
import
'text.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
/// A description of an icon fulfilled by a font glyph.
@immutable
...
...
pdf/lib/widgets/image.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic.dart'
;
import
'geometry.dart'
;
import
'image_provider.dart'
;
import
'widget.dart'
;
void
_paintImage
(
{
@required
PdfGraphics
canvas
,
...
...
pdf/lib/widgets/image_provider.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:typed_data'
;
import
'package:image/image.dart'
as
im
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'widget.dart'
;
/// Identifies an image without committing to the precise final asset
abstract
class
ImageProvider
{
...
...
pdf/lib/widgets/multi_page.dart
View file @
b533e40
...
...
@@ -14,7 +14,21 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'document.dart'
;
import
'flex.dart'
;
import
'geometry.dart'
;
import
'page.dart'
;
import
'page_theme.dart'
;
import
'text.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
abstract
class
WidgetContext
{
WidgetContext
clone
();
...
...
pdf/lib/widgets/page.dart
View file @
b533e40
...
...
@@ -14,7 +14,19 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'document.dart'
;
import
'geometry.dart'
;
import
'page_theme.dart'
;
import
'text.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
typedef
BuildCallback
=
Widget
Function
(
Context
context
);
typedef
BuildListCallback
=
List
<
Widget
>
Function
(
Context
context
);
...
...
@@ -84,12 +96,10 @@ class Page {
..
fillPath
();
}
@protected
void
generate
(
Document
document
)
{
_pdfPage
=
PdfPage
(
document
.
document
,
pageFormat:
pageFormat
);
}
@protected
void
postProcess
(
Document
document
)
{
final
canvas
=
_pdfPage
.
getGraphics
();
final
_margin
=
margin
;
...
...
pdf/lib/widgets/page_theme.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'geometry.dart'
;
import
'page.dart'
;
import
'text.dart'
;
import
'theme.dart'
;
@immutable
class
PageTheme
{
...
...
pdf/lib/widgets/partitions.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'flex.dart'
;
import
'geometry.dart'
;
import
'multi_page.dart'
;
import
'widget.dart'
;
class
Partition
implements
SpanningWidget
{
Partition
({
...
...
pdf/lib/widgets/placeholders.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:pdf/pdf.dart'
;
import
'basic.dart'
;
import
'geometry.dart'
;
import
'image.dart'
;
import
'text.dart'
;
import
'text_style.dart'
;
import
'widget.dart'
;
class
Placeholder
extends
Widget
{
Placeholder
(
...
...
pdf/lib/widgets/progress.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'geometry.dart'
;
import
'widget.dart'
;
class
CircularProgressIndicator
extends
Widget
{
CircularProgressIndicator
(
...
...
pdf/lib/widgets/qrcode.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
widget
;
import
'package:barcode/barcode.dart'
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'barcode.dart'
;
import
'decoration.dart'
;
import
'geometry.dart'
;
import
'widget.dart'
;
typedef
QrError
=
void
Function
(
dynamic
error
);
...
...
pdf/lib/widgets/stack.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'geometry.dart'
;
import
'widget.dart'
;
/// How to size the non-positioned children of a [Stack].
enum
StackFit
{
loose
,
expand
,
passthrough
}
...
...
pdf/lib/widgets/table.dart
View file @
b533e40
...
...
@@ -14,7 +14,21 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'container.dart'
;
import
'decoration.dart'
;
import
'flex.dart'
;
import
'geometry.dart'
;
import
'multi_page.dart'
;
import
'text.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
/// A horizontal group of cells in a [Table].
@immutable
...
...
pdf/lib/widgets/text.dart
View file @
b533e40
...
...
@@ -14,7 +14,17 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'annotations.dart'
;
import
'document.dart'
;
import
'geometry.dart'
;
import
'text_style.dart'
;
import
'theme.dart'
;
import
'widget.dart'
;
enum
TextAlign
{
left
,
right
,
center
,
justify
}
...
...
pdf/lib/widgets/text_style.dart
View file @
b533e40
...
...
@@ -14,7 +14,13 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'decoration.dart'
;
import
'font.dart'
;
import
'text.dart'
;
import
'widget.dart'
;
enum
FontWeight
{
normal
,
bold
}
...
...
pdf/lib/widgets/theme.dart
View file @
b533e40
...
...
@@ -14,7 +14,14 @@
* limitations under the License.
*/
part of
widget
;
import
'package:meta/meta.dart'
;
import
'basic.dart'
;
import
'font.dart'
;
import
'icon.dart'
;
import
'text.dart'
;
import
'text_style.dart'
;
import
'widget.dart'
;
@immutable
class
ThemeData
extends
Inherited
{
...
...
pdf/lib/widgets/widget.dart
View file @
b533e40
...
...
@@ -14,7 +14,16 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:collection'
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'document.dart'
;
import
'geometry.dart'
;
import
'page.dart'
;
@immutable
class
Context
{
...
...
@@ -106,13 +115,11 @@ abstract class Widget {
/// First widget pass to calculate the children layout and
/// bounding [box]
@protected
void
layout
(
Context
context
,
BoxConstraints
constraints
,
{
bool
parentUsesSize
=
false
});
/// Draw itself and its children, according to the calculated
/// [box.offset]
@protected
@mustCallSuper
void
paint
(
Context
context
)
{
assert
(()
{
...
...
pdf/lib/widgets/wrap.dart
View file @
b533e40
...
...
@@ -14,7 +14,15 @@
* limitations under the License.
*/
part of
widget
;
import
'dart:math'
as
math
;
import
'package:pdf/pdf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'flex.dart'
;
import
'geometry.dart'
;
import
'multi_page.dart'
;
import
'widget.dart'
;
/// How [Wrap] should align objects.
enum
WrapAlignment
{
...
...
pdf/test/data_types_test.dart
View file @
b533e40
...
...
@@ -16,7 +16,7 @@
import
'dart:typed_data'
;
import
'package:pdf/
pdf
.dart'
;
import
'package:pdf/
src/data_types
.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
...
...
pdf/test/ttf_test.dart
View file @
b533e40
...
...
@@ -17,6 +17,7 @@
import
'dart:io'
;
import
'package:pdf/pdf.dart'
;
import
'package:pdf/src/ttf_writer.dart'
;
import
'package:test/test.dart'
;
void
printText
(
...
...
Please
register
or
login
to post a comment