We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to insert an image in the middle of an already existing PDF

Is there a way to insert an image into an already existing pdf.

I’m trying to use Aspose.Pdf.Kit.PdfContentEditor but it does not have any function handling images.

Hi Hezi,

You can use AddImage method of PdfFileMend class. The following topics can also be helpful in performing this task:

I hope this helps. If you have any further questions, please do let us know.

Regards,

Hi Shahzad.Latif

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.

Regards,

Hi Hezi,

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.
Regards,

Hi Shahzad Latif,


What meant is that i’v managed to achieve this by using the PDFFileStamp but this object provides me only the ability to copy the PDF to a new one, so in order to do this i used a temporary PDF and afterwards i copied back the temporary to the original and this is alot of work just to insert an image a specially if i’m using a large PDF file.

Is there a way to do this directly to a page in the file.

I’m looking only to insert a picture to a specific location in a specific page behind the text that is already written in this page.

Hi Hezi,

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.
Regards,

Hi Shahzad Latif

I was wandering maybe there is a way to add a watermark directly to a specific page and location.

Regards,

Hi Hezi,

Please try the following samples to add different types of watermarks in a PDF file:




Add Watermark









Add Logo
		<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>