mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
feat: integrate placeholder replacement in PDF normalization process
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { PDFDocument } from '@cantoo/pdf-lib';
|
||||
|
||||
import { replacePlaceholdersInPDF } from './auto-place-fields';
|
||||
import { flattenAnnotations } from './flatten-annotations';
|
||||
import { flattenForm, removeOptionalContentGroups } from './flatten-form';
|
||||
|
||||
@ -13,6 +14,7 @@ export const normalizePdf = async (pdf: Buffer) => {
|
||||
removeOptionalContentGroups(pdfDoc);
|
||||
await flattenForm(pdfDoc);
|
||||
flattenAnnotations(pdfDoc);
|
||||
const pdfWithoutPlaceholders = await replacePlaceholdersInPDF(pdf);
|
||||
|
||||
return Buffer.from(await pdfDoc.save());
|
||||
return pdfWithoutPlaceholders;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user