Articles in this section
Category / Section

How to insert Objects at a specific location existing WinForms PDF?

1 min read

Insert objects at a specific location of an existing PDF:

You can draw the objects on 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 on the first page of the existing PDF document.

C#

// Load the document.
PdfLoadedDocument lDoc = new PdfLoadedDocument(@"ExistingPdf.pdf");
// Draw the rectangle at the 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 the 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 in an existing PDF.

You can refer to our WinForms PDF feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms PDF examples 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 or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied