Free Support Forum -

Adding image to existing Pdf file

Hi Support,

I tried to use c# code but i am getting errors. Reference is missing can you please let me know what dll i should add and Namespases .

System OS: WindowsXPProfession.
VS 2008 frame work 3.5.
If you see 1st picture the “Document” is in blue color which is class of Aspose.Words.Document but when i tried to get .Pages[1] its giving error Please see attachment.

I added reference. Merging PDF’s is working and Mapping PDF froms is also working.
Please see the picture and let me know where i am doing wrong?

This message was posted using Email2Forum by tilal.ahmad. (attachment)

Hi Sudheer,

Thanks for your inquiry. As you are using both Aspose.Pdf and Aspose.Words APIs in your project and both APIs have document class. So you have to use fully qualified name to avoid any ambiguous reference. Please check following sample code snippet and modify your code accordingly. Hopefully it will serve the purpose.

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(“input.pdf”);
pdfDocument.Pages[1].Resources.Images.Replace(1, new FileStream(“aspose-logo.jpg”, FileMode.Open));

Please feel free to contact us for any further assistance.

Best Regards,