You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to embed a font subset to a PDF, we have faced with an issue in OpenPdf, as it generates a new random name for a font subset each time a single PDF document is generated.
As in our signature creation tool, we need to execute the PDF generation twice, one for a ToBeSigned data generation and the second one for a final signed document generation, the generated PDF document shall be produced in a deterministic way.
The problem comes from a method BaseFont.createSubsetPrefix() generating a random prefix name for a font when a subset option is used. This makes the use of subsets impossible in our implementation, as the generated PDF and its digest respectively are always different.
Would it be possible to make the prefix computation deterministic somehow? For example by using org.bouncycastle.crypto.prng.FixedSecureRandom from BouncyCastle and the used glyphs within the provided subset as seed for pseudo random value generation.
Just for the information, there is no requirement in ISO 32000 to have the prefix random. It just shall be different for different subsets:
9.9.2 Font subsets
For a font subset, the PostScript name of the font, that is, the value of the font’s BaseFont entry and the
font descriptor’s FontName entry, shall begin with a tag followed by a plus sign (+) followed by the
PostScript name of the font from which the subset was created. The tag shall consist of exactly six
uppercase letters; the choice of letters is arbitrary, but different subsets of the same font in the same PDF file shall have different tags.
Thank you!
Best regards,
Aleksandr.
The text was updated successfully, but these errors were encountered:
Hello,
While trying to embed a font subset to a PDF, we have faced with an issue in OpenPdf, as it generates a new random name for a font subset each time a single PDF document is generated.
As in our signature creation tool, we need to execute the PDF generation twice, one for a ToBeSigned data generation and the second one for a final signed document generation, the generated PDF document shall be produced in a deterministic way.
The problem comes from a method BaseFont.createSubsetPrefix() generating a random prefix name for a font when a subset option is used. This makes the use of subsets impossible in our implementation, as the generated PDF and its digest respectively are always different.
Would it be possible to make the prefix computation deterministic somehow? For example by using org.bouncycastle.crypto.prng.FixedSecureRandom from BouncyCastle and the used glyphs within the provided subset as seed for pseudo random value generation.
Just for the information, there is no requirement in ISO 32000 to have the prefix random. It just shall be different for different subsets:
Thank you!
Best regards,
Aleksandr.
The text was updated successfully, but these errors were encountered: