mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-13 17:54:19 +01:00
feat: add PDF password prompt and centralized pdf-lib loader with auto-repair
This commit is contained in:
1 parent
9278774b8a
commit
bd44108296
19 files changed
+89
-78
No files matched your search
@@ -306,9 +306,7 @@ async function performCrop() {
|
||||
async function performMetadataCrop(
|
||||
cropData: Record<number, any>
|
||||
): Promise<Uint8Array> {
|
||||
const pdfToModify = await loadPdfDocument(cropperState.originalPdfBytes!, {
|
||||
throwOnInvalidObject: false,
|
||||
});
|
||||
const pdfToModify = await loadPdfDocument(cropperState.originalPdfBytes!);
|
||||
|
||||
for (const pageNum in cropData) {
|
||||
const pdfJsPage = await cropperState.pdfDoc.getPage(Number(pageNum));
|
||||
@@ -350,8 +348,7 @@ async function performFlatteningCrop(
|
||||
): Promise<Uint8Array> {
|
||||
const newPdfDoc = await PDFLibDocument.create();
|
||||
const sourcePdfDocForCopying = await loadPdfDocument(
|
||||
cropperState.originalPdfBytes!,
|
||||
{ throwOnInvalidObject: false }
|
||||
cropperState.originalPdfBytes!
|
||||
);
|
||||
const totalPages = cropperState.pdfDoc.numPages;
|
||||
|
||||
|
||||
Reference in new issue
Block a user