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

Adding attachment does not create AF entry (PDF/A compliance) #1560

Closed
florianbepunkt opened this issue Oct 30, 2024 · 2 comments
Closed

Adding attachment does not create AF entry (PDF/A compliance) #1560

florianbepunkt opened this issue Oct 30, 2024 · 2 comments

Comments

@florianbepunkt
Copy link

florianbepunkt commented Oct 30, 2024

Question

Description

Adding a file does not create the neccessary AF entry to pass PDF/A compliance checks.

Code sample

const doc = new PDFDocument({
  subset: "PDF/A-3a",
  pdfVersion: "1.7",
  size: "A4",
  tagged: true
})

doc.file(zugferdXML, {
  name: "zugferd-invoice.xml",
  description: "ZUGFeRD Invoice Data",
  creationDate: new Date(2020, 3, 1),
  modifiedDate: new Date(2020, 3, 1),
  type: "application/xml",
});

EDIT: I'm happy to work on this, but need some guidance on how to add catalogue objects.

Your environment

  • pdfkit version: "0.15.0
  • Node version: v20.11.1
  • Browser version (if applicable):
  • Operating System:
@florianbepunkt
Copy link
Author

I'm not familiar with the internal workings of this lib, but to achieve PDF/A compliance, two things would need to happen:

1.

const fileSpecBody = {

This would need to be extended to accept a AFRelationship property:

    const fileSpecBody = {
      Type: 'Filespec',
      AFRelationship: "Alternative", // AFAIK this can be Source or Alternative, must be use-supplied, possibly as an argument in doc.file() options
      F: new String(options.name),
      EF: {
        F: ref
      },
      UF: new String(options.name)
    };

2.

The fileSpec must be added to the catalogue – not sure how this is done in this lib. But the catalogue currently has entries for Names and Pages. Here a list with the key of AF would need to be added, which hold the fileSpecBody.

@florianbepunkt
Copy link
Author

Superseded by #1561

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant