#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import i18n from "i18next";
import {
isEditorPolicyBlocked,
isFileBlocked,
} from "@editor/services/policyBlockRegistry";
export { policySourceIds } from "@editor/services/policyBlockRegistry";
/** A required policy prevents using or exporting the document. */
export class PolicyBlockedError extends Error {
constructor() {
super(i18n.t("policy.recoveryBody"));
this.name = "PolicyBlockedError";
}
}
/** Recheck after asynchronous preparation, immediately before using the resulting bytes. */
export function assertFilesNotBlocked(
fileIds: Iterable<string | undefined> = [],
): void {
if (isEditorPolicyBlocked()) throw new PolicyBlockedError();
for (const fileId of fileIds) {
if (fileId && isFileBlocked(fileId)) throw new PolicyBlockedError();
}
}