David PHAM-VAN

Add more parameters to PdfObject

... ... @@ -5,6 +5,7 @@
- A borderRadius can only be given for a uniform Border
- Add LayoutWidgetBuilder
- Add GridPaper widget
- Improve internal sructure
## 1.13.0
... ...
... ... @@ -33,7 +33,7 @@ import 'stream.dart';
class PdfAnnot extends PdfObject {
PdfAnnot(this.pdfPage, this.annot)
: assert(annot != null),
super(pdfPage.pdfDocument, '/Annot') {
super(pdfPage.pdfDocument, type: '/Annot') {
pdfPage.annotations.add(this);
}
... ...
... ... @@ -33,7 +33,7 @@ class PdfCatalog extends PdfObject {
) : assert(pdfPageList != null),
assert(pageMode != null),
assert(names != null),
super(pdfDocument, '/Catalog');
super(pdfDocument, type: '/Catalog');
/// The pages of the document
final PdfPageList pdfPageList;
... ...
... ... @@ -22,7 +22,7 @@ import 'object.dart';
/// Encryption object
abstract class PdfEncryption extends PdfObject {
/// Creates an encryption object
PdfEncryption(PdfDocument pdfDocument) : super(pdfDocument, null);
PdfEncryption(PdfDocument pdfDocument) : super(pdfDocument);
/// Encrypt some data
Uint8List encrypt(Uint8List input, PdfObject object);
... ...
... ... @@ -34,7 +34,7 @@ abstract class PdfFont extends PdfObject {
/// font name to that in Pdf, defaulting to Helvetica if not possible.
PdfFont.create(PdfDocument pdfDocument, {@required this.subtype})
: assert(subtype != null),
super(pdfDocument, '/Font') {
super(pdfDocument, type: '/Font') {
pdfDocument.fonts.add(this);
}
... ...
... ... @@ -27,7 +27,7 @@ class PdfFontDescriptor extends PdfObject {
this.file,
) : assert(ttfFont != null),
assert(file != null),
super(ttfFont.pdfDocument, '/FontDescriptor');
super(ttfFont.pdfDocument, type: '/FontDescriptor');
/// File data
final PdfObjectStream file;
... ...
... ... @@ -28,7 +28,7 @@ class PdfInfo extends PdfObject {
this.subject,
this.keywords,
this.producer})
: super(pdfDocument, null) {
: super(pdfDocument) {
if (author != null) {
params['/Author'] = PdfSecString.fromString(this, author);
}
... ...
... ... @@ -25,10 +25,12 @@ class PdfObject {
/// This is usually called by extensors to this class, and sets the
/// Pdf Object Type
PdfObject(
this.pdfDocument, [
this.pdfDocument, {
String type,
]) : assert(pdfDocument != null),
objser = pdfDocument.genSerial() {
this.objgen = 0,
int objser,
}) : assert(pdfDocument != null),
objser = objser ?? pdfDocument.genSerial() {
if (type != null) {
params['/Type'] = PdfName(type);
}
... ... @@ -43,7 +45,7 @@ class PdfObject {
final int objser;
/// This is the generation number for this object.
final int objgen = 0;
final int objgen;
/// This allows any Pdf object to refer to the document being constructed.
final PdfDocument pdfDocument;
... ...
... ... @@ -29,7 +29,7 @@ class PdfObjectStream extends PdfObject {
PdfDocument pdfDocument, {
String type,
this.isBinary = false,
}) : super(pdfDocument, type);
}) : super(pdfDocument, type: type);
/// This holds the stream's content.
final PdfStream buf = PdfStream();
... ...
... ... @@ -28,7 +28,7 @@ class PdfPage extends PdfObject with PdfGraphicStream {
/// This constructs a Page object, which will hold any contents for this
/// page.
PdfPage(PdfDocument pdfDocument, {this.pageFormat = PdfPageFormat.standard})
: super(pdfDocument, '/Page') {
: super(pdfDocument, type: '/Page') {
pdfDocument.pdfPageList.pages.add(this);
}
... ...
... ... @@ -22,7 +22,7 @@ import 'page.dart';
/// PdfPageList object
class PdfPageList extends PdfObject {
/// This constructs a [PdfPageList] object.
PdfPageList(PdfDocument pdfDocument) : super(pdfDocument, '/Pages');
PdfPageList(PdfDocument pdfDocument) : super(pdfDocument, type: '/Pages');
/// This holds the pages
final List<PdfPage> pages = <PdfPage>[];
... ...
... ... @@ -30,7 +30,7 @@ class PdfSignature extends PdfObject {
Set<PdfSigFlags> flags,
}) : assert(crypto != null),
flags = flags ?? const <PdfSigFlags>{PdfSigFlags.signaturesExist},
super(pdfDocument, '/Sig');
super(pdfDocument, type: '/Sig');
final Set<PdfSigFlags> flags;
... ...