Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pdfa 3b #1584

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions pdf/lib/pdf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export 'src/pdf/obj/outline.dart';
export 'src/pdf/obj/page.dart';
export 'src/pdf/obj/page_label.dart';
export 'src/pdf/obj/pattern.dart';
export 'src/pdf/obj/pdf_a_3b.dart';
export 'src/pdf/obj/shading.dart';
export 'src/pdf/obj/signature.dart';
export 'src/pdf/obj/smask.dart';
Expand Down
6 changes: 6 additions & 0 deletions pdf/lib/src/pdf/obj/annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ abstract class PdfAnnotBase {
if (flags != null && flags!.isNotEmpty) {
params['/F'] = PdfNum(flagValue);
}
else {
// for pdfa compliance
params['/F'] = PdfNum(
4 // printable
);
}

if (date != null) {
params['/M'] = PdfString.fromDate(date!);
Expand Down
17 changes: 17 additions & 0 deletions pdf/lib/src/pdf/obj/catalog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'object.dart';
import 'outline.dart';
import 'page_label.dart';
import 'page_list.dart';
import 'pdf_a_3b.dart';

/// Pdf Catalog object
class PdfCatalog extends PdfObject<PdfDict> {
Expand Down Expand Up @@ -54,6 +55,12 @@ class PdfCatalog extends PdfObject<PdfDict> {
/// The document metadata
PdfMetadata? metadata;

/// Colorprofile output intent (Pdf/A)
PdfaColorProfile? colorProfile;

/// Attached files (Pdf/A 3b)
PdfaAttachedFiles? attached;

/// The initial page mode
final PdfPageMode? pageMode;

Expand Down Expand Up @@ -94,6 +101,12 @@ class PdfCatalog extends PdfObject<PdfDict> {
params['/Names'] = names!.ref();
}

// ??? what to do, if /Names is already occupied?
if (attached != null && attached!.isNotEmpty) {
params['/Names'] = attached!.catalogNames();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to merge them

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want code to create interactive pdf with audio video image hyperlink text
I have system to create interactive pdf for students courses in my institute

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

engaljafary@gmail.com
Please can you send me by this email i can payment

params['/AF'] = attached!.catalogAF();
}

// the PageLabels object
if (pageLabels != null && pageLabels!.labels.isNotEmpty) {
params['/PageLabels'] = pageLabels!.ref();
Expand Down Expand Up @@ -148,5 +161,9 @@ class PdfCatalog extends PdfObject<PdfDict> {
}
}
}

if (colorProfile != null) {
params['/OutputIntents'] = colorProfile!.outputIntents();
}
}
}
3 changes: 2 additions & 1 deletion pdf/lib/src/pdf/obj/metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class PdfMetadata extends PdfObject<PdfDictStream> {
@override
void prepare() {
super.prepare();
params['/SubType'] = const PdfName('/XML');
params['/Type'] = const PdfName('/Metadata');
params['/Subtype'] = const PdfName('/XML');
params.data = Uint8List.fromList(utf8.encode(metadata.toString()));
}
}
Loading
Loading