David PHAM-VAN

Add ObjectDict

... ... @@ -25,12 +25,13 @@ import 'font.dart';
import 'graphic_stream.dart';
import 'graphics.dart';
import 'object.dart';
import 'object_dict.dart';
import 'page.dart';
import 'point.dart';
import 'rect.dart';
import 'stream.dart';
class PdfAnnot extends PdfObject {
class PdfAnnot extends PdfObjectDict {
PdfAnnot(this.pdfPage, this.annot)
: super(pdfPage.pdfDocument, type: '/Annot') {
pdfPage.annotations.add(this);
... ...
... ... @@ -19,11 +19,12 @@ import 'data_types.dart';
import 'document.dart';
import 'names.dart';
import 'object.dart';
import 'object_dict.dart';
import 'outline.dart';
import 'page_list.dart';
/// Pdf Catalog object
class PdfCatalog extends PdfObject {
class PdfCatalog extends PdfObjectDict {
/// This constructs a Pdf Catalog object
PdfCatalog(
PdfDocument pdfDocument,
... ...
... ... @@ -19,14 +19,14 @@ import 'dart:convert';
import 'data_types.dart';
import 'document.dart';
import 'font_metrics.dart';
import 'object.dart';
import 'object_dict.dart';
import 'point.dart';
import 'stream.dart';
import 'type1_font.dart';
import 'type1_fonts.dart';
/// Pdf font object
abstract class PdfFont extends PdfObject {
abstract class PdfFont extends PdfObjectDict {
/// 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})
... ...
... ... @@ -16,11 +16,12 @@
import 'data_types.dart';
import 'object.dart';
import 'object_dict.dart';
import 'object_stream.dart';
import 'ttffont.dart';
/// Font descriptor object
class PdfFontDescriptor extends PdfObject {
class PdfFontDescriptor extends PdfObjectDict {
/// Create a Font descriptor object
PdfFontDescriptor(
this.ttfFont,
... ...
... ... @@ -26,14 +26,10 @@ class PdfObject {
/// Pdf Object Type
PdfObject(
this.pdfDocument, {
String? type,
// String? type,
this.objgen = 0,
int? objser,
}) : objser = objser ?? pdfDocument.genSerial() {
if (type != null) {
params['/Type'] = PdfName(type);
}
pdfDocument.objects.add(this);
}
... ...
/*
* Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'data_types.dart';
import 'document.dart';
import 'object.dart';
/// Object with a PdfDict used in the PDF file
class PdfObjectDict extends PdfObject {
/// This is usually called by extensors to this class, and sets the
/// Pdf Object Type
PdfObjectDict(
PdfDocument pdfDocument, {
String? type,
int objgen = 0,
int? objser,
}) : super(pdfDocument, objgen: objgen, objser: objser) {
if (type != null) {
params['/Type'] = PdfName(type);
}
}
/// This is the object parameters.
final PdfDict params = PdfDict();
@override
String toString() => '$runtimeType $params';
}
... ...
... ... @@ -19,11 +19,11 @@ import 'dart:typed_data';
import 'ascii85.dart';
import 'data_types.dart';
import 'document.dart';
import 'object.dart';
import 'object_dict.dart';
import 'stream.dart';
/// Stream Object
class PdfObjectStream extends PdfObject {
class PdfObjectStream extends PdfObjectDict {
/// Constructs a stream object to store some data
PdfObjectStream(
PdfDocument pdfDocument, {
... ...
... ... @@ -19,7 +19,7 @@ import 'data_types.dart';
import 'document.dart';
import 'graphic_stream.dart';
import 'graphics.dart';
import 'object.dart';
import 'object_dict.dart';
import 'object_stream.dart';
import 'page_format.dart';
... ... @@ -39,7 +39,7 @@ enum PdfPageRotation {
}
/// Page object, which will hold any contents for this page.
class PdfPage extends PdfObject with PdfGraphicStream {
class PdfPage extends PdfObjectDict with PdfGraphicStream {
/// This constructs a Page object, which will hold any contents for this
/// page.
PdfPage(
... ...
... ... @@ -16,11 +16,11 @@
import 'data_types.dart';
import 'document.dart';
import 'object.dart';
import 'object_dict.dart';
import 'page.dart';
/// PdfPageList object
class PdfPageList extends PdfObject {
class PdfPageList extends PdfObjectDict {
/// This constructs a [PdfPageList] object.
PdfPageList(PdfDocument pdfDocument) : super(pdfDocument, type: '/Pages');
... ...
... ... @@ -17,11 +17,12 @@
import 'data_types.dart';
import 'document.dart';
import 'object.dart';
import 'object_dict.dart';
import 'stream.dart';
enum PdfSigFlags { signaturesExist, appendOnly }
class PdfSignature extends PdfObject {
class PdfSignature extends PdfObjectDict {
PdfSignature(
PdfDocument pdfDocument, {
required this.crypto,
... ...