Create signature box - iTextSharp
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Create signature box - iTextSharp

  1. #1
    Join Date
    Jan 2010
    Posts
    130

    Question Create signature box - iTextSharp

    I'm not sure if this is in the right forum since it concerns iTextSharp in my C# app.

    I have created a PDF form which is supposed to be printed out and signed by various people. I have tried to create a box in iTextSharp containing a couple of lines next to each other where people can sign their names and underneath each line the name of the person in question is dynamically displayed. I have been fiddling around with cells, changing borders and stuff to try to recreate these lines in the right place, but there must be a faster/better way? Does a template signing box already exist that I could implement?

    As you can see my current code is very messy and the cells arent positioning themselves next to each other like I wanted (I wanted 3 cells next to each other each of colspan 2):

    Code:
                Phrase date = new Phrase(SData.sCurrentDate, fontDetails);
                Phrase signAdvisor = new Phrase("Beurteiler", fontDetails);
                Phrase signTrainee = new Phrase("Auszubildender", fontDetails);
                Phrase signInstructor = new Phrase("Ausbildungsleitung", fontDetails);
    
                Phrase advisorName = new Phrase("( " + advisor.Firstname + " " + advisor.Surname + " )", fontDetails);
                Phrase traineeName = new Phrase("( " + trainee.Firstname + " " + trainee.Surname + " )", fontDetails);
                //Phrase instructorName = new Phrase("( " + trainee. + " )", fontDetails);
    
                PdfPTable tblSignature = new PdfPTable(1);
                PdfPCell cellHeader = new PdfPCell(new Phrase("Ich habe von der Beurteilung Kenntnis genommen:", fontBody));
                PdfPCell cellSignature = new PdfPCell();
                PdfPCell cellSigned = new PdfPCell();
                PdfPCell cellBlank = new PdfPCell(new Phrase("", fontTitle));
    
                // line 1
                cellHeader.Colspan = 6;
                cellHeader.BorderWidthBottom = 0;
                cellHeader.HorizontalAlignment = 0;
                cellHeader.BorderWidthBottom = 0;
    
                // line 2
                cellBlank.Colspan = 6;
                cellBlank.Border = 0;
    
                // line 3
                cellSignature.BorderWidthTop = 0;
                cellSignature.BorderWidthBottom = 1;
                cellSignature.BorderWidthLeft = 1;
                cellSignature.Colspan = 6;
                cellSignature.AddElement(date);
    
                // line 4
                cellSigned.Colspan = 6;
                cellSignature.BorderWidthTop = 0;
                cellSigned.BorderWidthBottom = 1;
                cellSigned.AddElement(signAdvisor);
                cellSigned.AddElement(advisorName);
                cellSigned.AddElement(signTrainee);
                cellSigned.AddElement(traineeName);
                cellSigned.AddElement(signInstructor);
    
                // add to doc
                tblSignature.AddCell(cellHeader);
                tblSignature.AddCell(cellBlank);
                tblSignature.AddCell(cellSignature);
                tblSignature.AddCell(cellSigned);
                doc.Add(tblSignature);

  2. #2
    Join Date
    Jan 2010
    Posts
    130

    Re: Create signature box - iTextSharp

    I have rewritten my code to make a better iTextsharp signature box so I dont need to have my code checked anymore. I would still however like to know if there is a better/different way to do this...

  3. #3
    Join Date
    Feb 2010
    Posts
    1

    Re: Create signature box - iTextSharp

    Hello there,
    I am trying to determine how to add a written signature image to an existing PDF.
    Currently, I use an FDF formatted file to load up all of the database data into the PDF Form.
    But I am stuck trying to get an image onto the PDF.
    I presume I need to modify the PDF, and then open the FDF to get all of the data loaded, and then I need to use iTextsharp to load up the written signature image.
    I need to push the image over to the PDF, but I am not sure if this is the "correct" approach.

    I have a C++ desktop application. SQL Server 2008 is the database.

    Thanks,

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center