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

Add experimental PDF/A compliance mode #3269

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Starfox64
Copy link
Contributor

@Starfox64 Starfox64 commented Sep 1, 2023

This PR adds experimental PDF/A compliance mode and closes #1106

I'm calling this experimental for multiple reasons:

  • Currently only supports the CPDF backend
  • Only takes care of adding the required metadata
  • Doesn't force font embedding, it's on the user to embed their fonts
  • I can only test so many documents, the user should generally verify actual compliance with a tool like veraPDF (profile PDF/A-3b) and report issues
  • Isn't as robust GhostScript

This still should work for most people on non esoteric documents.

Addendum

Fixes #3442

@bsweeney bsweeney added this to the 2.0.5 milestone Sep 1, 2023
lib/Cpdf.php Outdated Show resolved Hide resolved
lib/Cpdf.php Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you say where you got this file?
What licence it is?
Is this the same file as https://sources.debian.org/src/tcpdf/6.7.4%2Bdfsg-1/include/sRGB.icc/?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!
Let's let @bsweeney let us know if adding a licence file should be done like in https://github.com/dompdf/php-font-lib/tree/master/tests/resources/fonts/ahem

Copy link
Member

Choose a reason for hiding this comment

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

I think this makes sense. Naming ... something like sRGB2014.icc.LICENSE (ugly)? Or should we put the ICC profile in a sub-directory with the standard-named LICENSE file?

The copyright owner and terms of use of an ICC profile are normally identified in the Creator field in the profile header and in the Copyright tag. Where ICC is the copyright owner, the following license terms apply:

"This profile is made available by the International Color Consortium, and may be copied, distributed, embedded, made, used, and sold without restriction. Altered versions of this profile shall have the original identification and copyright information removed and shall not be misrepresented as the original profile."

(reference https://www.color.org/profiles2.xalter#license)

Co-authored-by: William Desportes <williamdes@wdes.fr>
Copy link
Contributor

@williamdes williamdes left a comment

Choose a reason for hiding this comment

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

The diff looks good, maybe some concerns about the licencing of the binary file

@williamdes
Copy link
Contributor

@Starfox64 do you think it would solve #3269 ?

@Starfox64
Copy link
Contributor Author

That's the wrong Issue ID I think.

@williamdes
Copy link
Contributor

williamdes commented Apr 19, 2024

Indeed, this one: #3442

Could you rebase your work ?
I was about to try it but composer wants 2.1+

🇫🇷 👋🏻

@Starfox64
Copy link
Contributor Author

I've done a merge recently and it looks like I'm ahead of master.

With regards to #3442 I think this might be fixed by this line https://github.com/dompdf/dompdf/pull/3269/files#diff-f365bcb24d5c081b6bfde4aa59a8eda68824ea9658c362098554fc659dcec1d0R3426

It's funny to see that we are literally trying to do the same thing btw, nothing spells out fun more than trying to embed XML in PDF metadata.

@williamdes
Copy link
Contributor

I've done a merge recently and it looks like I'm ahead of master.

With regards to #3442 I think this might be fixed by this line https://github.com/dompdf/dompdf/pull/3269/files#diff-f365bcb24d5c081b6bfde4aa59a8eda68824ea9658c362098554fc659dcec1d0R3426

It's funny to see that we are literally trying to do the same thing btw, nothing spells out fun more than trying to embed XML in PDF metadata.

Okayy, I got it wrong: barryvdh/laravel-dompdf[v2.1.0, ..., v2.1.1] require dompdf/dompdf ^2.0.3
So I will "downbase" your work and test it for 2.0

@williamdes
Copy link
Contributor

@bsweeney
Copy link
Member

FYI I'm re-targeting this to 3.1 (from 3.0.1) since it's a new feature not a patch. I know there are a lot of issues slate for 3.0.x releases but I suspect most of those will be pushed out once I have a chance to review them.

@bsweeney bsweeney modified the milestones: 3.0.1, 3.1.0 Apr 19, 2024
Copy link
Contributor

@williamdes williamdes left a comment

Choose a reason for hiding this comment

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

Can you add Fixes: #3442 to this PR ?
It passes nearly all compliance tests except

[Specification: ISO 19005-3:2012, Clause: 6.2.11.4.1, Test number: 1](https://github.com/veraPDF/veraPDF-validation-profiles/wiki/PDFA-Parts-2-and-3-rules#rule-621141-1)	
The font programs for all fonts used for rendering within a conforming file shall be embedded within that file, as defined in ISO 32000-1:2008, 9.9.	Failed

Let's follow up on #3443

@bsweeney bsweeney linked an issue Apr 19, 2024 that may be closed by this pull request
@williamdes williamdes mentioned this pull request Apr 19, 2024
@williamdes
Copy link
Contributor

Would you mind reviewing this first batch @bsweeney ?
This is quite critical for me as I need to progress into PDF/A + Factur-x

/**
* @var bool Is PDF/A compliance mode enabled
*/
public $pdfa = false;
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to generically support PDF/A since various levels of compliance are defined? Should we just support a specific version which evolves as we update the library.

Also, instead of a flag for PDF/A support should we define constants (e.g., DOMPDF::PDF17, DOMPDF::PDFA1A) for various specifications and store the desired spec in a property, using that to toggle functionality?

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

Successfully merging this pull request may close these issues.

EOL marker shall be immediately followed by a % PDF/A
3 participants