-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloudflare blocks sign PDF #280
Comments
Have you spoken to cloudflare? |
I’m trying to contact them as well. Previously, I used to work with : What has changed between the libraries? |
We don't know specifically what cloudflare is blocking or what they don't like. Is it specifically to do with the content of the PDF? With the signature? With that particular instance of a signature? I'm not intimately familiar with the exact differences, but I don't see why they should produce vastly different signatures that would make cloudflare think there's embedded PHP, command injections, etc in them. Have you looked at the PDF files in a text editor to see what is different? |
That stream doesn't look well formed to me, it should be binary data but it's made up of ASCII, which is unusual. I suspect there's some encoding problem somewhere which is corrupting something. I don't know what exactly, you'll have to debug what is going on. You aren't following the example for pdf-lib, so maybe that's a problem too? const signPdfLib = async (pdfBuffer, signer) =>{
try {
const pdfDoc = await PDFDocument.load(pdfBuffer);
pdflibAddPlaceholder({
pdfDoc: pdfDoc,
reason: 'Digital Invoice Signature',
contactInfo: '',
name: 'Digital Signature',
location: 'Israel',
signingTime: new Date().toISOString(),
signatureLength: 8192,
subFilter: 'adbe.pkcs7.detached',
});
pdfWithPlaceholder = await pdfDoc.save();
return signpdf.sign(pdfWithPlaceholder, signer)
} catch (err) {
throw {message:`signature faild, error : ${err}`};
}
} |
If I follow the example, I encounter an error: This happens because pdfDoc.save returns a Uint8Array, while signpdf.sign expects a Buffer. Am I missing something in the process? |
Then do this const signPdfLib = async (pdfBuffer, signer) =>{
try {
const pdfDoc = await PDFDocument.load(pdfBuffer);
pdflibAddPlaceholder({
pdfDoc: pdfDoc,
reason: 'Digital Invoice Signature',
contactInfo: '',
name: 'Digital Signature',
location: 'Israel',
signingTime: new Date().toISOString(),
signatureLength: 8192,
subFilter: 'adbe.pkcs7.detached',
});
pdfWithPlaceholder = await pdfDoc.save();
- return signpdf.sign(pdfWithPlaceholder, signer)
+ return signpdf.sign(Buffer.from(pdfWithPlaceholder), signer)
} catch (err) {
throw {message:`signature faild, error : ${err}`};
}
} |
Thank you for the quick response - I really appreciate it! I’ve encountered an issue: if I don’t use pdfDoc.save({ useObjectStreams: false }), I get the following error: |
ok, and if you add that in? |
Yes, The document was signed, but it’s still being blocked by Cloudflare. |
Is there a way to add a placeholder using plainAddPlaceholder so that the signature will be visible in Adobe Reader? |
Yep - it seems there's a compatibility issue with lib-pdf and this lib at the moment, then. Perhaps something changed under the hood with pdf-lib in a version and we've not kept up. |
If I use this function. const signPdfLib = async (pdfBuffer, signer) => {
try {
const pdfWithPlaceholder = await plainAddPlaceholder({
pdfBuffer: pdfBuffer,
reason: 'Digital Invoice Signature',
contactInfo: 'Wizsoft',
name: 'Wizsoft Digital Signature',
location: 'Israel',
signingTime: new Date().toISOString(),
signatureLength: 8192,
subFilter: 'adbe.pkcs7.detached',
appName: 'Wizsoft Digital Signature System',
widgetRect: [0, 0, 595, 842]
});
return signpdf.sign(pdfWithPlaceholder, signer);
} catch (err) {
throw {message:`signature faild, error : ${err}`};
}
} |
I don't know why it is not showing, presumably because not all the signatures are valid? What does the signature pane say? |
The window doesn’t open—this is exactly the problem. It’s as if the document isn’t signed. |
what the difrent and how to do not block and visible in Adobe Reader ?
Attachments
signed_plain.pdf
signed_pdflib.pdf
The text was updated successfully, but these errors were encountered: