mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-11 17:23:37 +01:00
fix: trim whitespace from resource body
This commit is contained in:
1 parent
75e76c9619
commit
6b4e9f2a94
1 file changed
+2
-2
@@ -375,7 +375,7 @@ export async function protectType3Text(bytes) {
|
|||||||
`/Contents ${cnum} 0 R`
|
`/Contents ${cnum} 0 R`
|
||||||
);
|
);
|
||||||
if (fonts.resRef >= 0) {
|
if (fonts.resRef >= 0) {
|
||||||
let res = fonts.resBody;
|
let res = fonts.resBody.trim();
|
||||||
const xo = res.match(/\/XObject\s*<<([\s\S]*?)>>/);
|
const xo = res.match(/\/XObject\s*<<([\s\S]*?)>>/);
|
||||||
res = xo
|
res = xo
|
||||||
? res.replace(xo[0], `/XObject <<${xo[1]} ${entries} >>`)
|
? res.replace(xo[0], `/XObject <<${xo[1]} ${entries} >>`)
|
||||||
@@ -493,7 +493,7 @@ export async function protectFragileText(bytes) {
|
|||||||
`/Contents ${cnum} 0 R`
|
`/Contents ${cnum} 0 R`
|
||||||
);
|
);
|
||||||
if (rref) {
|
if (rref) {
|
||||||
let res = resBody;
|
let res = resBody.trim();
|
||||||
const xo = res.match(/\/XObject\s*<<([\s\S]*?)>>/);
|
const xo = res.match(/\/XObject\s*<<([\s\S]*?)>>/);
|
||||||
res = xo
|
res = xo
|
||||||
? res.replace(xo[0], `/XObject <<${xo[1]} ${entries} >>`)
|
? res.replace(xo[0], `/XObject <<${xo[1]} ${entries} >>`)
|
||||||
|
|||||||
Reference in new issue
Block a user