mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2024-12-21 19:08:24 +01:00
Fix: page break insertion functionality in Multi Tool (#2350)
Fix page break insertion functionality - Page Break insertion functionality now successfully inserts page breaks upon request
This commit is contained in:
parent
b32d6cb858
commit
de9c21b3de
@ -165,43 +165,14 @@ class PdfContainer {
|
|||||||
|
|
||||||
|
|
||||||
async addFilesBlank(nextSiblingElement) {
|
async addFilesBlank(nextSiblingElement) {
|
||||||
const pdfContent = `
|
let doc = await PDFLib.PDFDocument.create();
|
||||||
%PDF-1.4
|
let docBytes = await doc.save();
|
||||||
1 0 obj
|
|
||||||
<< /Type /Catalog /Pages 2 0 R >>
|
const url = URL.createObjectURL(new Blob([docBytes], { type: 'application/pdf' }));
|
||||||
endobj
|
|
||||||
2 0 obj
|
const renderer = await this.toRenderer(url);
|
||||||
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
|
|
||||||
endobj
|
await this.addPdfFile(renderer, doc, nextSiblingElement);
|
||||||
3 0 obj
|
|
||||||
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Contents 5 0 R >>
|
|
||||||
endobj
|
|
||||||
5 0 obj
|
|
||||||
<< /Length 44 >>
|
|
||||||
stream
|
|
||||||
0 0 0 595 0 842 re
|
|
||||||
W
|
|
||||||
n
|
|
||||||
endstream
|
|
||||||
endobj
|
|
||||||
xref
|
|
||||||
0 6
|
|
||||||
0000000000 65535 f
|
|
||||||
0000000010 00000 n
|
|
||||||
0000000071 00000 n
|
|
||||||
0000000121 00000 n
|
|
||||||
0000000205 00000 n
|
|
||||||
0000000400 00000 n
|
|
||||||
trailer
|
|
||||||
<< /Size 6 /Root 1 0 R >>
|
|
||||||
startxref
|
|
||||||
278
|
|
||||||
%%EOF
|
|
||||||
`;
|
|
||||||
const blob = new Blob([pdfContent], { type: 'application/pdf' });
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
const file = new File([blob], "blank_page.pdf", { type: "application/pdf" });
|
|
||||||
await this.addPdfFile(file, nextSiblingElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user