MCPcopy Create free account
hub / github.com/LibPDF-js/core / parseVersion

Function parseVersion

src/security/encryption-dict.ts:168–180  ·  view source on GitHub ↗

* Parse and validate the encryption version.

(dict: PdfDict)

Source from the content-addressed store, hash-verified

166 * Parse and validate the encryption version.
167 */
168function parseVersion(dict: PdfDict): EncryptionVersion {
169 const version = dict.getNumber("V")?.value;
170
171 if (version === undefined) {
172 throw new EncryptionDictError("Missing /V (version) in encryption dictionary");
173 }
174
175 if (!isEncryptionVersion(version)) {
176 throw new EncryptionDictError(`Unsupported encryption version: ${version}`);
177 }
178
179 return version;
180}
181
182/**
183 * Parse and validate the encryption revision.

Callers 2

parseEncryptionDictFunction · 0.85
upgradeVersionMethod · 0.85

Calls 2

isEncryptionVersionFunction · 0.90
getNumberMethod · 0.45

Tested by

no test coverage detected