How to Draw Text and Bitmap on PDFs

In this tutorial, we explore the process of using Iron PDF to draw text and bitmap images on PDFs in a C# console application. The video starts with the installation of Iron PDF via the NuGet package manager. We then move into coding, starting with including necessary namespaces such as Iron PDF, Iron Software.Drawing, and System.IO. After adding a license key for Iron PDF, we initialize a ChromePdfRenderer object to convert HTML content, specifically a header tag, into a PDF document.

The tutorial demonstrates how to add text to the PDF using the DrawText method, specifying parameters like font type, size, page index, coordinates, color, and rotation angle. Text is added using the Times New Roman font, size 12, positioned on the first page at coordinates (100, 100), in black color.

Next, the tutorial guides you on how to add an image to the PDF. An image named IronSoftware.PNG is loaded from a specified path using Bitmap.FromFile. The DrawBitmap method is employed to position the image on the first page at coordinates (50, 250), scaled to dimensions of 500x300 pixels.

Finally, the PDF is saved using the SaveAs method with a specified file path. The tutorial concludes by running the project to verify the output, showcasing the added text and image in the PDF. This tutorial demonstrates the simplicity and efficiency of using Iron PDF for PDF manipulation in a C# console application. For more tutorials and a trial subscription, viewers are encouraged to subscribe and visit the provided link.

Further Reading: How to Draw Text and Bitmap on PDFs

Chipego
Software Engineer
Chipego has a natural skill for listening that helps him to comprehend customer issues, and offer intelligent solutions. He joined the Iron Software team in 2023, after studying a Bachelor of Science in Information Technology. IronPDF and IronOCR are the two products Chipego has been focusing on, but his knowledge of all products is growing daily, as he finds new ways to support customers. He enjoys how collaborative life is at Iron Software, with team members from across the company bringing their varied experience to contribute to effective, innovative solutions. When Chipego is away from his desk, he can often be found enjoying a good book or playing football.
< PREVIOUS
How to Extract Embedded Text and Images from PDFs in C#
NEXT >
How to Draw Lines and Rectangles on PDFs