How to insert Objects at a specific location existing WinForms PDF?
Insert objects at a specific location of an existing PDF:
You can draw the objects in the specified page, in the specified location, in an existing PDF using the Page. Graphics property.
You can refer to the following code example to draw the image in the specified location in the first page of the existing PDF document.
C#
//Load the document. PdfLoadedDocument lDoc = new PdfLoadedDocument(@"ExistingPdf.pdf"); //Draw the rectangleat specified location of the existing pdf file. lDoc.Pages[0].Graphics.DrawRectangle(PdfPens.Blue, new RectangleF(0, 0, 200, 200)); //Create the image. Image img = Image.FromFile(@"..\..\Data\logo.png"); PdfImage image = PdfImage.FromImage(img); //Draw the image at specified position. lDoc.Pages[0].Graphics.DrawImage(image, new PointF(200,0)); //Save and close the document. lDoc.Save("Sample.pdf"); lDoc.Close(true);
Sample Link:
Conclusion
I hope you enjoyed learning about how to insert Objects at a specific location of an existing PDF.
You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms PDF example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!