Drawing an image on an existing page of a PDF

Discussions about PDF management.
Post Reply
User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Drawing an image on an existing page of a PDF

Post by Loïc » Fri Aug 05, 2011 2:21 am

Code: Select all

 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
      Dim oGdPicturePDF As New GdPicturePDF
      Dim oGdPictureImaging As New GdPictureImaging

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

      Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\test.tif")

      If ImageID <> 0 AndAlso oGdPicturePDF.LoadFromFile("c:\test.pdf", True) = GdPictureStatus.OK Then
         oGdPicturePDF.SelectPage(1) 'Selecting first page

         Dim image_res_name As String = oGdPicturePDF.AddImageFromGdPictureImage(ImageID, False, False)
         oGdPictureImaging.ReleaseGdPictureImage(ImageID)
         oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
         oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
         oGdPicturePDF.DrawImage(image_res_name, 10, 10, 5, 5)
         oGdPicturePDF.SaveToFileInc("c:\test.pdf")
         oGdPicturePDF.CloseDocument()

         MsgBox("Done")
      End If
   End Sub

arcadyAbr
Posts: 6
Joined: Mon Aug 08, 2011 8:39 am

Re: Drawing an image on an existing page of a PDF

Post by arcadyAbr » Wed Sep 14, 2011 11:30 am

How can this operation be done using the GDPicture Pro OCX?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest