Birt and digital signature

Options
Mr.Reed
edited February 11, 2022 in Analytics #1
<p><span>Hello,<br><br>
we are using Birt within a j2ee-application for generating pdfs.<br><br>
Is there a way to add a digital signature to birt meanwhile? are there any solutions by now? I only found post being two years old giving the hint, that i can use itext for manipulating the pdf after the birt-generating?<br><br>
Thanks in advance for any hints oder solutions.<br><br>
Marco</span></p>
Warning No formatter is installed for the format ipb

Comments

  • <p>There haven't been any changes to the PDF emitter in the last two years, I don't believe. Using iText is probably the way to go. This is probably the post you saw, I'm assuming?</p>
    <p> </p>
    <p><a data-ipb='nomediaparse' href='http://developer.actuate.com/community/forum/index.php?/topic/17750-digital-signature-in-pdf-with-birt/'>http://developer.actuate.com/community/forum/index.php?/topic/17750-digital-signature-in-pdf-with-birt/</a></p&gt;
    Warning No formatter is installed for the format ipb
  • <p>Hello Michael,</p>
    <p> </p>
    <p>thanks for your reply.</p>
    <p> </p>
    <p>Yes, that is exactly the post i was relating to.</p>
    <p>So if there haven't been any changes to the emitter, do you know if there is might something planned in future releases?</p>
    Warning No formatter is installed for the format ipb
  • <p>I don't think there is anything planned for this in the future, but I could be wrong. You could go to eclipse.org/birt and to the community section to request an enhancement for this in the bugzilla. You might also search the list to see if it's there and just vote for an existing request. If you find one or post something yourself, put the request info in here to be able to point others who happen upon this post to vote for it.</p>
    Warning No formatter is installed for the format ipb
  • <p>Hello again,</p>
    <p> </p>
    <p>i would like to have another take on this one.</p>
    <p> </p>
    <p>To be clearer what i want to do: I would like to put a field on the pdf, which meets the requirements of being able to put an electronical signature (hand-written and signed, like signing an insurance-contract) on the document. does <a data-ipb='nomediaparse' href='http://en.signotec.com/'>signotec </a>mean anything to do? That seems to be  the software or standard for electronical standard on the one side. Preparing the pdf at first is what i would have to do, to be able to be used from that software.</p>
    <p>Therefore it would be sweet, if i could put an report item in my report template, that meets that kind of requirement.</p>
    <p>In iText there is a possibility to do this. Michael, your recent link to this one post seems to be specific about digital signature (heck, i can't keep these meanings apart...).</p>
    <p>So this is what i would be doing right now in iText (found this somewhere in the net):</p>
    <pre class="_prettyXprint">
    package foo;

    import java.awt.Color;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import com.lowagie.text.Document;
    import com.lowagie.text.DocumentException;
    import com.lowagie.text.Paragraph;
    import com.lowagie.text.Rectangle;
    import com.lowagie.text.pdf.PdfAnnotation;
    import com.lowagie.text.pdf.PdfAppearance;
    import com.lowagie.text.pdf.PdfFormField;
    import com.lowagie.text.pdf.PdfWriter;

    public class Test {

    /** Path to the resulting PDF file. */
    public static final String RESULT = "test.pdf";

    public static void main(String[] args) throws DocumentException, IOException {
    new Test().createPdf(RESULT);
    }

    public void createPdf(String filename) throws DocumentException, IOException {
    // step 1
    Document document = new Document();
    // step 2
    PdfWriter pdfWriter = PdfWriter.getInstance(document, new FileOutputStream(filename));
    pdfWriter.getAcroForm().setNeedAppearances(false);
    // step 3
    document.open();
    // step 4
    document.add(new Paragraph("Electronical Signature Test"));

    PdfFormField field = PdfFormField.createSignature(pdfWriter);
    field.setWidget(new Rectangle(100, 732, 300, 780), PdfAnnotation.HIGHLIGHT_INVERT);
    field.setFieldName("Signatur");
    field.setFlags(PdfAnnotation.FLAGS_PRINT);
    field.setPage();
    field.setMKBorderColor(Color.BLACK);
    field.setMKBackgroundColor(Color.WHITE);

    PdfAppearance tp = PdfAppearance.createAppearance(pdfWriter, 72, 48);
    tp.rectangle(0.5f, 0.5f, 71.5f, 47.5f);
    tp.stroke();
    field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);

    pdfWriter.addAnnotation(field);

    // step 5
    document.close();
    }
    }

    </pre>
    <p>Advantage of having a report item is, that i can place whereever i want to on my birt template. Since my report is dynamic, the iText-solution would complicate everything, because i would have to find one spot, where i could place that signature field, which limits the possibilites in an dynamic report.</p>
    <p> </p>
    <p>So I was thinking i could write an extension in birt, which allows to put an report item in the template which has these features i would need. Since Birt is based on iText, i was thinking this should be possible. So i started playing around trying to get used to how to write an extension. But it seems there is no up-to-date documentation of what to do. The <a data-ipb='nomediaparse' href='https://www.eclipse.org/articles/article.php?file=Article-BIRT-ExtensionTutorial1/index.html'>rotated text item - tutorial</a> is marked as deprecated and tested with version up to 2.3.1. But i am using already version 4.4.2 and i am not able to run the sample from the tutorial.</p>
    <p> </p>
    <p>Furthermore i wasn't able to find any existing requests for this In Bugzilla.</p>
    <p> </p>
    <p>So i hope i was able to clarify a bit better what i would like to do. </p>
    <p> </p>
    <p>Now i have the kind request for some help on this (again).</p>
    <p>is there any up-to-date info on how to write an extension or what else i could try to do?</p>
    <p> </p>
    <p>Best Regards</p>
    <p>Marco</p>
    Warning No formatter is installed for the format ipb
  • <p>Hey Marco,</p>
    <p> </p>
    <p>An emitter and palette item would likely have to be created to make this completely dynamic. However, if you were to create dynamic PDFs with BIRT and in your design, create a signature page that would follow the dynamic content, you could easily use an API, like the e-SignLive by Silanis API to take your created PDF and add an e-Signature block. A very simple example would be:</p>
    <p> </p>
    <p></p><pre class="_prettyXprint _linenums:0">package com.esignlive.example;
     
    import com.silanis.esl.sdk.DocumentPackage;
    import com.silanis.esl.sdk.EslClient;
    import com.silanis.esl.sdk.PackageId;
    import com.silanis.esl.sdk.SessionToken;
     
    import static com.silanis.esl.sdk.builder.DocumentBuilder.newDocumentWithName;
    import static com.silanis.esl.sdk.builder.PackageBuilder.newPackageNamed;
    import static com.silanis.esl.sdk.builder.SignatureBuilder.signatureFor;
    import static com.silanis.esl.sdk.builder.SignerBuilder.newSignerWithEmail;
     
    public class SimpleCreateAndSendPackage {
     
        public static final String API_KEY = "<Your e-SignLive API Key>"; //Can get this by signing up for a sandbox account
        public static final String API_URL = "https://sandbox.e-signlive.com/api"; // USE https://apps.e-signlive.com/api FOR PRODUCTION
     
        public static void main( String[] args ) {
            EslClient eslClient = new EslClient( API_KEY, API_URL );
            // Build the DocumentPackage object
            DocumentPackage documentPackage = newPackageNamed( "Test Package API" )
                    .withSigner( newSignerWithEmail( "signer.email@example.com" )
                            .withCustomId( "Signer" )
                            .withFirstName( "fName" )
                            .withLastName( "lName" ) )
                    .withSigner( newSignerWithEmail( "preparer.email@example.com" )
                            .withFirstName( "yourFName" )
                            .withLastName( "yourLName" ) )
                    .withDocument( newDocumentWithName( "sampleAgreement" )
                            .fromFile( "yourPDFCreatedByBIRT.pdf" )
                            .withSignature( signatureFor( "preparer.email@example.com" )
                                    .onPage( 0 )  //would need to be set for your signature page
                                    .atPosition( 175, 165 ) )  //this position would have to match where the signature area is on the signature page
                            .withSignature( signatureFor( "preparer.email@example.com") //only needed if you will want to sign the document too
                            .onPage( 0 )
                            .atPosition( 550, 165 )))
                    .build();
     
            // Issue the request to the e-SignLive server to create the DocumentPackage
            PackageId packageId = eslClient.createPackage( documentPackage );
     
            // Send the package to be signed by the participants
            eslClient.sendPackage( packageId );
     
            System.out.println("Package sent");
        }
    }
    </pre>
    Warning No formatter is installed for the format ipb