How to Draw Text & Bitmap on PDFs using C#
IronPDF enables you to draw text and images on existing PDFs using the DrawText and DrawBitmap methods, allowing customization with watermarks, logos, annotations, and improved visual appearance without altering original content.
Drawing text and images on a PDF involves adding content to an existing document. IronPDF seamlessly enables this feature. By incorporating text and images, you can customize PDFs with watermarks, logos, and annotations, improving the document's visual appearance and branding. Additionally, text and images facilitate information presentation, data visualization, and interactive form creation.
Quickstart: Add Text and Images to PDFs with IronPDFStart enhancing your PDF documents with text and images quickly and efficiently. Using the DrawText and DrawBitmap methods, you can easily customize PDFs by adding watermarks, logos, or annotations. This example demonstrates how to draw text at specific coordinates and insert an image seamlessly into your PDF.
-
1Install IronPDF with NuGet Package Manager
-
2Copy and run this code snippet.
new ChromePdfRenderer() .RenderHtmlAsPdf("<h1>Doc</h1>") .DrawText("Hello World", FontTypes.TimesNewRoman.Name, 12, 0, 100, 100, Color.Black, 0) .DrawBitmap(AnyBitmap.FromFile("logo.png"), 0, 50, 250, 500, 300) .SaveAs("annotated.pdf");C# -
3Deploy to test on your live environment
Start using IronPDF in your project today with a free trial
Minimal Workflow (5 steps)
- Download the C# library for IronPDF to draw text and images on PDFs
- Import the targeted PDF document
- Use the
DrawTextmethod to add text with the desired font to the imported PDF - Add an image to the PDF using the
DrawBitmapmethod - Export the edited PDF document
How Do I Draw Text on PDF?
The DrawText method available on the PdfDocument object allows you to add text to an existing PDF without altering its original content. This method is particularly useful for adding dynamic content to PDFs, similar to the stamp text and image feature for more complex overlays.
Understanding Coordinate System
Before drawing text, understand the PDF coordinate system. The origin (0,0) is located at the bottom-left corner of the page, with X values increasing to the right and Y values increasing upward. This differs from many graphics systems where the origin is at the top-left.
using IronPdf;
using IronSoftware.Drawing;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");
// Draw text on PDF
pdf.DrawText("Some text", FontTypes.TimesNewRoman.Name, FontSize: 12, PageIndex: 0, X: 100, Y: 100, Color.Black, Rotation: 0);
pdf.SaveAs("drawText.pdf");Imports IronPdf
Imports IronSoftware.Drawing
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")
' Draw text on PDF
pdf.DrawText("Some text", FontTypes.TimesNewRoman.Name, FontSize:=12, PageIndex:=0, X:=100, Y:=100, Color.Black, Rotation:=0)
pdf.SaveAs("drawText.pdf")What Fonts Can I Use?
The DrawText method currently supports all Standard Fonts in IronPDF, including Courier, Arial (or Helvetica), TimesNewRoman, Symbol, and ZapfDingbats. Visit the 'Standard Fonts in IronPDF' section in the Manage Fonts article for italic, bold, and oblique variants of these font types.
The ZapfDingbats font can display symbols such as ▲. For a comprehensive list of supported symbols, visit Wikipedia on Zapf Dingbats.
Output fonts sample on PDF

How Can I Add Text with Line Breaks?
The draw text action supports newline characters, allowing you to render text with built-in newlines for better formatting and visual clarity. This is useful when adding multi-line annotations or creating structured text layouts.
To achieve this, add newline characters (\n) to the text string. Using the example above:
// Multi-line text example with proper spacing
string textWithNewlines = "Some text\nSecond line\nThird line with more content";
pdfDoc.DrawText(textWithNewlines, FontTypes.Arial.Name, 12, 0, 100, 100, Color.Black, 0);
// You can also use Environment.NewLine for platform-specific line breaks
string platformText = $"Line 1{Environment.NewLine}Line 2{Environment.NewLine}Line 3";
pdfDoc.DrawText(platformText, FontTypes.Arial.Name, 12, 0, 100, 100, Color.Black, 0);
How Do I Use Custom Fonts?
Custom fonts are supported with the DrawText method, expanding your typography options beyond standard fonts. This feature is essential when maintaining brand consistency or working with specialized fonts. For advanced font management, see our guide on managing fonts in PDFs.
Below is an example with the Pixelify Sans Font added for the text:
using IronPdf;
using IronSoftware.Drawing;
using System.IO;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");
// Add custom font to the PDF
byte[] fontByte = File.ReadAllBytes(@".\PixelifySans-VariableFont_wght.ttf");
var addedFont = pdf.Fonts.Add(fontByte);
// Draw text on PDF
pdf.DrawText("Iron Software", addedFont.Name, FontSize: 12, PageIndex: 0, X: 100, Y: 600, Color.Black, Rotation: 0);
pdf.SaveAs("drawCustomFont.pdf");Imports IronPdf
Imports IronSoftware.Drawing
Imports System.IO
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")
' Add custom font to the PDF
Private fontByte() As Byte = File.ReadAllBytes(".\PixelifySans-VariableFont_wght.ttf")
Private addedFont = pdf.Fonts.Add(fontByte)
' Draw text on PDF
pdf.DrawText("Iron Software", addedFont.Name, FontSize:= 12, PageIndex:= 0, X:= 100, Y:= 600, Color.Black, Rotation:= 0)
pdf.SaveAs("drawCustomFont.pdf")Advanced Text Positioning
When positioning text precisely, consider these tips:
- Page Dimensions: Use
pdf.Pages[pageIndex].Widthandpdf.Pages[pageIndex].Heightto get page dimensions - Rotation: The rotation parameter accepts degrees (0-360) for angled text
- Color Options: Beyond basic colors, use RGB values:
Color.FromArgb(255, 100, 100)
The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.
How Do I Draw Images on PDF?
IronPDF's DrawBitmap method enables you to add bitmaps to existing PDF documents. This method functions similarly to the Image Stamper feature, allowing you to stamp images onto existing PDFs. For complex image manipulation needs, explore our guide on adding images to PDFs.
DrawBitmap method works best with large images. When using smaller resolution images, you may encounter the following exception: IronPdf.Exceptions.IronPdfNativeException: 'Error while drawing image: data length (567000) is less than expected (756000)'. To overcome this issue, use the Image Stamper, which handles images of all sizes.Sample image

What Does the Implementation Look Like?
using IronPdf;
using IronSoftware.Drawing;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");
// Open the image from file
AnyBitmap bitmap = AnyBitmap.FromFile("ironSoftware.png");
// Draw the bitmp on PDF
pdf.DrawBitmap(bitmap, 0, 50, 250, 500, 300);
pdf.SaveAs("drawImage.pdf");Imports IronPdf
Imports IronSoftware.Drawing
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")
' Open the image from file
Dim bitmap As AnyBitmap = AnyBitmap.FromFile("ironSoftware.png")
' Draw the bitmap on PDF
pdf.DrawBitmap(bitmap, 0, 50, 250, 500, 300)
pdf.SaveAs("drawImage.pdf")Output PDF
What Additional Parameters Are Available?
- PixelFormat: The
PixelFormatproperty specifies the color data format for the bitmap, primarily controlling transparency support. The default value isFormat32bppArgb. Choose between pixel enum formatsFormat32bppRgbandFormat32bppArgbby passing the parameter as an option. This is useful when working with background and foreground elements in PDFs. - IgnorePageRotation: This
boolproperty determines whether the method ignores page rotation when drawing the bitmap. By default, the value is false. Especially useful when applying watermarks consistently to all pages, regardless of rotation.
Common Use Cases and Best Practices
When drawing text and images on PDFs, consider these practical applications:
- Dynamic Watermarking: Add company logos or "CONFIDENTIAL" stamps to sensitive documents
- Page Numbering: Draw page numbers in consistent positions across all pages
- Signature Placement: Add signature images at designated locations on forms
- Header/Footer Enhancement: Complement existing headers with dynamic content
For debugging and monitoring PDF operations, implement custom logging to track drawing operations and ensure proper execution.
Performance Considerations
When working with multiple pages or large documents:
- Batch operations when possible to minimize memory usage
- Dispose of bitmap objects after use to free resources
- Consider pre-loading frequently used images to improve performance
Ready to see what else you can do? Check out our tutorial page here: Edit PDFs
Frequently Asked Questions
What is the DrawText method in IronPDF?
The DrawText method in IronPDF allows you to add text to an existing PDF using a specified font, size, and location. This method is useful for inserting dynamic content such as annotations, watermarks, or branding logos without altering the original PDF content.
How can I draw images on a PDF using IronPDF?
To draw images on a PDF using IronPDF, utilize the DrawBitmap method. This function allows you to insert bitmap images into PDF documents for watermarking, branding, or document enhancement purposes. You can specify the image's position and size within the PDF.
Can custom fonts be used with IronPDF?
Yes, IronPDF supports custom fonts with the DrawText method. This flexibility allows for brand consistency or the use of specialized fonts. You can add a custom font from a file and use it to draw text in the PDF.
What are some common use cases for drawing text and images on PDFs?
Common use cases for drawing text and images on PDFs include adding dynamic watermarks, such as company logos or 'CONFIDENTIAL' stamps, numbering pages consistently, placing signature images on forms, and enhancing headers and footers with dynamic content.
What additional image parameters are available with the DrawBitmap method?
The DrawBitmap method allows you to specify additional parameters such as PixelFormat, which controls the bitmap's color data format, and IgnorePageRotation, a boolean determining whether to ignore page rotation when drawing the bitmap.
How is the PDF coordinate system structured in IronPDF?
In IronPDF, the PDF coordinate system originates at the bottom-left corner of the page. X values increase to the right, and Y values increase upward, differing from many graphics systems where the origin is at the top-left.
What fonts are supported by the DrawText method in IronPDF?
The DrawText method in IronPDF supports several standard fonts, including Courier, Arial (Helvetica), TimesNewRoman, Symbol, and ZapfDingbats. Additionally, it offers italic, bold, and oblique variants of these fonts.
How can I add text with line breaks in IronPDF?
You can add text with line breaks in IronPDF by including newline characters '\n' within the text string. This feature is useful for creating multi-line annotations or structured text layouts in PDFs.
What are some performance considerations when using IronPDF for large documents?
When handling large documents in IronPDF, consider batching operations to reduce memory usage, disposing of bitmap objects after use to free resources, and pre-loading frequently used images to boost performance.
How does the DrawBitmap method handle small resolution images?
For smaller resolution images causing exceptions with DrawBitmap, using the Image Stamper is recommended as it effectively handles images of all sizes and avoids errors like the 'IronPdfNativeException'.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.