pdftron / pdftron-sign-app Goto Github PK
View Code? Open in Web Editor NEWSign and request signatures on PDFs, MS Office documents
License: Other
Sign and request signatures on PDFs, MS Office documents
License: Other
Objective:
I'm attempting to merge my annotations from a new URL on my domain and the xfdf data stored in the database and receive the following error but am unsure what it means or how to troubleshoot that.
{ message:
'Exception: \n\t Message: XML Parsing error\n\t Conditional expression: false\n\t Version : 8.1 .0.30519\n\t Platform : Linux\n\t Architecture : AMD64\n\t Filename : XMLParser.cpp\n\t Function : Advance\n\t Linenumber : 132\n',
type: 'InvalidPDF' }
I pull the pdf link this:
const urlx = await new URL(`https://mydomain.com/uploads/${uuid}/${docRef}`);
const doc = await PDFNet.PDFDoc.createFromURL(urlx.href);
It happens when I attempt to add the xml data via let res to this:
await PDFNet.FDFDoc.createFromXFDF(res);
This is what is contained inside of "res":
<?xml version="1.0" encoding="UTF-8"?><xfdf xmlns="http://ns.adobe.com/xfdf/" xmlns:xml="" xml:space="preserve"><fields><field name="[email protected]"><field name="io_SIGNATURE_16121228784590"><value>_DEFAULT</value></field></field></fields><annots><ink page="0" rect="141.353,462.4451018329939,460.397,581.139" color="#000000" flags="print" name="bb08dcd4-eb07-413b-bb35-31edf0397635" title="Guest" subject="Signature" date="D:20210131115455-08'00'" creationdate="D:20210131115454-08'00'"><inklist><gesture>149.25870672097759,538.9391317040055;150.1611846571623,538.9391317040055;155.57605227427024,544.353 9993211134;165.50330957230145,555.1837345553292;180.84543448744063,567.8184256619145;205.21233876442636 ,578.6481608961303;220.55446367956552,579.550638832315;222.35941955193482,578.6481608961303;221.4569416 1575017,566.0134697895452;206.11481670061102,545.256477257298;177.235522742702,526.3044405974201;151.06 366259334695,511.8647936184657;142.94136116768502,507.3524039375425;168.2107433808554,505.5474480651730 6;237.70154446707403,499.23010251188055;349.60880855397147,483.88797759674134;431.7343007467754,468.545 8526816021;442.56403598099115,464.03346300067886;438.95412423625254,464.03346300067886;430.831822810590 6,464.03346300067886;429.92934487440607,464.9359409368635;429.0268669382213,479.3755879158181;440.75908 010862184,492.9127569585879;454.29624915139175,504.64497012898846;458.808638832315,510.9623156822811;45 8.808638832315,514.5722274270197;456.10120502376105,518.1821391717583</gesture></inklist></ink></annots><pages><defmtx matrix="1,0,0,-1,0,792"/></pages></xfdf>
So based on the error I'm unsure if its a XML issue or a PDF issue in the way that I'm storing the file in the urlx.href link..
Any help in troubleshooting would be appreciated.
Hello! I'm trying to develop an API for PAdES Signatures using PDFTron and OpenSSL and I have an issue while adding signingCertificatev2 attribute which is required by PAdES standard. I tried to use this slice of code to create ESS_SIGNING_CERT field:
ESS_SIGNING_CERT_V2* signing_cert = OSSL_ESS_signing_cert_v2_new_init(EVP_get_digestbyname(this->hash_type.c_str()), this->x509_cert, this->x509_chain, -1);
int len_sign_cert = i2d_ESS_SIGNING_CERT_V2(signing_cert, NULL);
unsigned char* encoded_data = (unsigned char*)malloc(len_sign_cert * sizeof(unsigned char));
unsigned char* copy = encoded_data;
i2d_ESS_SIGNING_CERT_V2(signing_cert, &encoded_data);
ASN1_OCTET_STRING* octet_string = ASN1_OCTET_STRING_new();
ASN1_OCTET_STRING_set(octet_string, copy, len_sign_cert);
PKCS7_add_signed_attribute(p7Si, NID_id_smime_aa_signingCertificateV2, V_ASN1_OCTET_STRING, octet_string);
I also tried to create this field using this method:
static std::vector<UChar> pdftron::PDF::DigitalSignatureField::GenerateESSSigningCertPAdESAttribute (const Crypto::X509Certificate & in_signer_cert,
const Crypto::DigestAlgorithm::Type in_digest_algorithm_type)
my function has the following code:
PDFDoc& PadesSignatureService::signfile(SignatureHandler&handler,char*Reason)
{
SignatureHandlerId sigHandlerId = this->document->AddSignatureHandler(handler);
this->signature_field->SignOnNextSaveWithCustomHandler(sigHandlerId);
Date* d = new Date();
d->SetCurrentTime();
this->signature_field->SetSigDictTimeOfSigning(*d);
//i tried with and without this sequence (i replaced it with the OpenSSL field for ESSSIgnatureCert when i didn't use this call)
std::vector<unsigned char>signing_certificate = this->signature_field->GenerateESSSigningCertPAdESAttribute(((PadesSignatureBHandler&)handler).getcertificate(), ((PadesSignatureBHandler&)handler).getdigestalgorithm());
Obj sig_dict = this->signature_field->GetSDFObj();
sig_dict.FindObj("V").PutName("SubFilter", "ETSI.CAdES.detached");
this->signature_field->SetReason(Reason);
char *output_file=get_output_filename(this->filename);
try {
this->document->Save(output_file, SDFDoc::e_incremental, NULL);
}
catch (pdftron::Common::Exception e)
{
std::cout << e.GetMessage();
}
return *(this->document);
}
Now, the issue is that my signature is recognized by FoxitReader, but not by AdobeReader. The error that I encounter is this one:
In FoxitReader, the signature does not have any problem:
Using DSS Verification I obtained the following results:
I attach here also the report of DSS:
DSS-Detailed-report.pdf
I used a GemBox PKCS12 for testing.
Could you help me?
Best Wishes,
Ionut Corbu
pdftron-sign-app\node_modules\postcss-safe-parser\lib\safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
anybody who can help me in this to run?
index.js:1 [2023-04-03T15:39:18.803Z] @firebase/firestore: Firestore (8.2.2): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.