Loading...

Add image on a new PDF page in the center.

Support for GdPicturePDF Plugin.

Add image on a new PDF page in the center.

Postby coolwater » Tue Dec 20, 2011 1:56 pm

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!
coolwater
 
Posts: 8
Joined: Wed Nov 09, 2011 6:45 pm

Re: Add image on a new PDF page in the center.

Postby Loïc » Tue Dec 20, 2011 5:30 pm

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()
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

Re: Add image on a new PDF page in the center.

Postby coolwater » Thu Dec 22, 2011 12:45 am

Thanks!
coolwater
 
Posts: 8
Joined: Wed Nov 09, 2011 6:45 pm


Return to GdPicture PDF Plugin

Who is online

Users browsing this forum: No registered users and 0 guests

cron