locked
ITextSharp 5.0.2 Paragraph Alignment RRS feed

  • Question

  • User-1298022718 posted

    Hi All,

    Am currently developing an application in vb.net to write information to a pdf, using itextsharp 5.0.2.

    I have been able to add images and paragraps to the pdf without any problem.

    I build up my document as shown below

     

                ' Create instance of iTextSharp object
                Dim doc As New Document(PageSize.A4, 75, 75, 50, 50)
    
                ' Get full path of file
                Dim path As String = System.Web.HttpContext.Current.Server.MapPath("~/authenticated/letters/" + _debt.DebtId.ToString + "-stage1-letter.pdf")
    
                ' Create writer to listen to this document and write to stream
                PdfWriter.GetInstance(doc, New FileStream(path, FileMode.Create))
    
                ' Open document
                doc.Open()
    
                ' Setup default font
                Dim fontBold As Font = FontFactory.GetFont("Tahoma", 11, Font.BOLD)
                Dim fontDefault As Font = FontFactory.GetFont("Tahoma", 11, Font.NORMAL)
    
                ' Get relevant letterhead logo
                Dim headerImage As Image = Image.GetInstance(System.Web.HttpContext.Current.Server.MapPath(_pcLogoPath))
    
                headerImage.ScalePercent(6)
                doc.Add(headerImage)


    Then to add a new paragraph i am using..

     

                Dim p1 As New Paragraph
                p1.Font = fontDefault
                p1.SpacingAfter = 10
                p1.Add("Dear Sirs")
                doc.Add(p1)

     

    I am trying to create a footer on the pdf document. Therefore I need to create a new paragraph which is positioned absolute bottom. This is the latest version of iText (5.0.2) and i know that they have removed the headerfooter feature, which was included in previous versions. I have searched and searched for possible solutions but cannot find anything suitable.

    Has anyone had a similar issue or know of a fix?

     

    Many Thanks

    Matt

     

    Thursday, May 6, 2010 7:00 AM

All replies