Is there a way to insert an image into an already existing pdf.
You can use AddImage method of PdfFileMend class. The following topics can also be helpful in performing this task:
- Adhere Image
- Adding Images and Text using PdfFileMend class
- Manipulating Images in an Existing PDF File
I hope this helps. If you have any further questions, please do let us know.
I've used the example with the PdfFileMend and i've added an image to the pdf in a specific location, but actualy what i was looking for is to add the image behind the text.
i've tried to use the PdfFileStamp for this but it copies the pdf with the addition of an image to the background and it is not so effective especially if the pdf is a very large one.
I'm looking for inserting the image only in a specific page without copying the pdf to a another pdf with an addition of an image.
As I understand, your requirement can be fulfilled using PdfFileStamp class, but you’re not completely satisfied with it. However, can you please elaborate your concerns a little bit? For example, when a file is modified like stamped etc. it is recreated and saved to a new output file; is it like you want to avoid this copying process or there is something else in your mind?
Please elaborate your requirement, so we could help you out accordingly.
Hi Shahzad Latif,
I’m sorry to inform you that it is currently not possible to save the changes to the same file, as the component has to recreate the objects with the new changes merged in between. However, I have logged a new feature request as PDFKITNET-19765 in our issue tracking system. Our team will investigate to find out if that would be feasible and provide support in future versions accordingly.
We’re sorry for the inconvenience.
Please try the following samples to add different types of watermarks in a PDF file:
<table style="border-width: 0pt;" cellpadding="0" cellspacing="0"><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td class="treeNode" onmouseover="TreeView_HoverNode(ctl00_ContentPlaceHolder1_APITree_Data, this)" onmouseout="TreeView_UnhoverNode(this)"><a class="treeNode" href="../../documentation/.net-components/aspose.pdf.kit-for-.net/add-background.html" id="ctl00_ContentPlaceHolder1_APITreet53" style="text-decoration: none; border-style: none;">Add Background</a></td></tr></tbody></table><br>You'll notice that there is a Pages property which allows you to set the number of page(s) on which you want to add the watermark and a method named SetOrigin which allows you to specify the coordinates where you want to add the watermark. <br><br>I hope this helps. If it doesn't satisfy your requirement or I couldn't understand your requirement completely then please do let us know.<br>Regards,<br>