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

make CIDSet generation optional again for TrueTypeFontUnicode (subset = true) #1041

Closed
zyro23 opened this issue Feb 6, 2024 · 4 comments
Closed

Comments

@zyro23
Copy link
Contributor

zyro23 commented Feb 6, 2024

Is your feature request related to a problem? Please describe.
#815 (release 1.3.31) added generating a CIDSet for TrueTypeFontUnicode if subset is true:

however, the referenced PDF/A-1 validation rule (6.3.5-3) is not required for PDF/A version 2 and 3 compliance.

a pdf without CIDSet streams that contains only a subset of the used fonts validates fine with PDF/A versions 2 and 3.

but if a CIDSet is present, all CIDs of the font have to be present which means effectively the complete font being embedded:

If the FontDescriptor dictionary of an embedded CID font contains a CIDSet stream, then it shall identify all CIDs which are present in the font program, regardless of whether a CID in the font is referenced or used by the PDF or not.

Describe the solution you'd like
please allow to opt out of CIDSet generation for TrueTypeFontUnicode (Identity-H, embedded= true, subset = true) again.

Describe alternatives you've considered

  • disabling PdfWriter.pdfxConformance has no effect because the subset check takes precedence (see referenced pr)
  • setting subset = false "works" but is no viable option - that results in pdf file size differences of megabytes instead of a few kb because the complete fonts are embedded

Additional context
versions up to 1.3.30 are working fine.

thank you!

@andreasrosdal
Copy link
Contributor

@bsanchezb May you investigate this please?

@bsanchezb
Copy link
Contributor

Hi,

Our scenario is that an end-user provides a document and wants it to be signed with a visual electronic signature. The initial document format is not known, but the signature creation tool should be able to keep PDF/A conformance when possible.

The PR #815 keeps the conformance by default, while also adding CIDSet for other document types, when font is used. But it does not break conformance for those documents neither.

I see that @zyro23 sees this information as redundant in their case.

The only alternative option I can see, because OpenPdf is not capable of identifying PDF/A type of the document, is to add a separate boolean variable, something like "includeCIDSet", which may be used to explicitly modify the behavior of the CIDSet creation, instead of using "subset". Or we can even use "subset && includeCIDSet" in order to include the CIDSet.

I would keep the value of "includeCIDSet" as TRUE by default, as this will protect users from breaking PDF/A-1 conformant documents.

KR,
Aleksandr

@zyro23
Copy link
Contributor Author

zyro23 commented Feb 12, 2024

completed?

i think the reasoning for an additional boolean flag makes sense (being used instead of subset).
ok for me if it defaults to true - at least that will not break the current behavior again.

i can come up with a pr and would make the flag accessible via TrueTypeFontUnicode only (not exposing it via getter/setter up to BaseFont like subset).

sounds ok? if so, please re-open.

@andreasrosdal andreasrosdal reopened this Feb 12, 2024
@andreasrosdal
Copy link
Contributor

Please submit a pull request, thank you.

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

No branches or pull requests

3 participants