Add image on a new PDF page in the center.
Add image on a new PDF page in the center.
How can I add an image on a new page in the middle of page? I saw an example on how to add an image, but we like to know how to position it in the middle. Thanks!
Re: Add image on a new PDF page in the center.
Here we go:
Code: Select all
Dim oGdPicturePDF As New GdPicturePDF
Dim oGdPictureImaging As New GdPictureImaging
oGdPicturePDF.LoadFromFile("c:\input.pdf", False)
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\input.tif")
oGdPicturePDF.SelectPage(1)
Dim pageWidth As Single = oGdPicturePDF.GetPageWidth
Dim pageHeight As Single = oGdPicturePDF.GetPageHeight
oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint)
oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginBottomLeft)
Dim imageResName As String = oGdPicturePDF.AddImageFromGdPictureImage(ImageID, False, False)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
oGdPicturePDF.DrawImage(imageResName, pageWidth / 3, pageHeight / 3, pageWidth / 3, pageHeight / 3)
oGdPicturePDF.SaveToFile("c:\output.pdf")
oGdPicturePDF.CloseDocument()
Who is online
Users browsing this forum: No registered users and 0 guests