Loading...

Adding text on an existing PDF

Support for GdPicturePDF Plugin.

Adding text on an existing PDF

Postby Loïc » Fri Jul 29, 2011 10:12 pm

Hello,

Here a snippet to add text on an existing PDF using incremental saving :


Code: Select all
   Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
      Dim oGdPicturePDF As New GdPicturePDF

      oGdPicturePDF.SetLicenseNumber("XXX") 'Replace XXX by a valid demo or commercial key

      If oGdPicturePDF.LoadFromFile("c:\test.pdf", True) = GdPictureStatus.OK Then
         oGdPicturePDF.SelectPage(1) 'Selecting first page
         Dim font_res_name As String = oGdPicturePDF.AddTrueTypeFont("Arial", False, False, False)
         oGdPicturePDF.SetTextMode(PdfTextMode.PdfTextModeFill)
         oGdPicturePDF.SetTextSize(30)
         oGdPicturePDF.SetFillColor(255, 0, 0, 0) 'Using Cyan colour
         oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
         oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
         oGdPicturePDF.DrawText(font_res_name, 1, 1, "Hello World!")
         oGdPicturePDF.SaveToFileInc("c:\test.pdf")
         oGdPicturePDF.CloseDocument()
         MsgBox("Done")
      End If
   End Sub
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4445
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Return to GdPicture PDF Plugin

Who is online

Users browsing this forum: No registered users and 0 guests

cron