0

I'm trying to sign multiple documents with Embarcadero C++ Builder 11.2 and Gnostice PDFToolkit VCL, but it only signs the first one. In the second it gives an error that I attach. Does somebody knows why it could be? This is the code:

for(int i=0; i<FileListBox1->Items->Count; i++){
        if(FileExists(FileListBox1->Items->Strings[i])){
            FileListBox1->Selected[i] =  true;
            try{
                gtPDFDocumento->LoadFromFile(FileListBox1->Items->Strings[i]);
                gtPDFDocumento->AddSignature("firma.pfx", "pass", Now(), "texto", "Toledo", "925.28.39.50", 2 , "Firma Digital IACLM", gtRect(365, 935, 760, 990), LDisplayOptions, c, FT);
                gtPDFDocumento->SaveToFile("firmado."+FileListBox1->Items->Strings[i]);

                //Liberar recursos
                gtPDFDocumento->Reset();

                FreeAndNil(gtPDFDocumento);
            }
            catch(Exception *e){
                ShowMessage("Ha ocurrido el error: "+e->Message+", avise a infórmatica.");
                ShowMessage("Error. No se ha podido firmar la liquidación, hable con informática.");
                return;
            }
        }
        else{
            ShowMessage("Error. No se encuentra el PDF, hable con informática.");
            return;
        }
}

Thanks.

I'm trying to sign multiple documents with Embarcadero C++ Builder 11.2 and Gnostice PDFToolkit VCL, but it only signs the first one. In the second it gives an error that I attach

  • *"In the second it gives an error that I attach"* - I don't see any error attached... – mkl Dec 15 '22 at 11:49
  • Please add the error as text, if at all possible. If it is a popup window on a GUI, then I think attaching a screenshot is warranted, but even then you should also write it out, so that the text can be found by search. – hyde Dec 15 '22 at 11:59
  • I have solved it by reloading the signed document: gtPDFDocumento->LoadFromFile(""]); gtPDFDocumento->AddSignature("); gtPDFDocumento->SaveToFile("); //Hay que volver a cargar el pdf porque si no da error gtPDFDocumento->LoadFromFile(" – Fco. Javier Bermejo Cogolludo Dec 16 '22 at 07:21

0 Answers0