Hi,
I want to add a image to exsting pdf file. I am using DynamicPDF v4.0.0 in Vb.net.
How to add new image to existing pdf
Re: How to add new image to existing pdf
Support · Jun 5, 2013Hello Anoop,
Yes, you can add image to the already existing PDF document without any problem. You will need to build Image class object using the image's file path and setting desired X and Y position then access the page within the PDF using index and add the image to it. Please refer documentation on Image class here
. Also below is the sample code for it.
Dim MyPdf As PdfDocument = New PdfDocument("C:\Input.pdf")
Dim MyMergeDocument As MergeDocument = New MergeDocument(MyPdf)
'build Image class object by setting the desired X and Y positions.
Dim MyImage As Image = New Image("E:\temporary\Images\Winter.jpg", 100, 100, 0.5F)
'Access the desired page within the PDF.
Dim MyPage As Page = MyMergeDocument.Pages(0) '0 index is to access first page.
MyPage.Elements.Add(MyImage)
MyMergeDocument.Draw("C:\MyDocument_v4.pdf")
Thanks,
ceTe Software Support Team.
Re: How to add new image to existing pdf
Forum member · Jun 5, 2013Dear Support team,
Thanks for your quick reply.
I am using DynamicPDF.dll and i add this dll as reference.
while using your code its showing MergeDocument is not defined.
can you please explain how can i add Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements. can you please help.
Re: How to add new image to existing pdf
Support · Jun 5, 2013Hello,
You will need to import the Merger namespace in your application to use the classes and methods and this will work for you. The MergeDocument class is affiliated to the Merger namespace. Below is the sample code for it.
Imports ceTe.DynamicPDF.Merger
Thanks,
ceTe Software Support Team.