Edit PDFs
Leverage our countless features that build on existing PDF files to finalize them into perfect output files.
Edit PDF Objects with Precision
Translate PDF Objects
Move and position PDF objects such as images, text, and shapes with precision, ensuring that elements are correctly aligned and placed within your document.
Learn how to:access PDF DOM objectsusing IronPdf;
using System.Drawing;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("Test");
// Access DOM Objects
var objects = pdf.Pages.First().ObjectModel.TextObjects.First();
// Translate by 100 points right and 100 points down
objects.Translate = new System.Drawing.PointF(100,100);Imports IronPdf
Imports System.Drawing
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("Test")
' Access DOM Objects
Dim objects = pdf.Pages.First().ObjectModel.TextObjects.First()
' Translate by 100 points right and 100 points down
objects.Translate = New System.Drawing.PointF(100, 100)Scale PDF Objects
Resize PDF objects to meet your design requirements. Scale images, text, or other elements to achieve the desired appearance without losing quality.
Learn how to:scale PDF DOM objectsusing IronSoftware;
using System.Drawing; // Required for PointF
// Create a PDF from a URL using a PNG image
string html = @"<img src='https://example.com/logo.png'>";
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Render HTML to PDF
PdfDocument pdf = renderer.RenderHtmlAsPdf(html);
// Access the first image object on the first page
ImageObject image = pdf.Pages.First().ObjectModel.ImageObjects.FirstOrDefault();
// To scale the image to 150% of its original size uniformly
image.Scale = new System.Drawing.PointF(1.5f, 1.5f);
// Save the PDF with the scaled image
pdf.SaveAs("scaled_image.pdf");Imports IronSoftware
Imports System.Drawing ' Required for PointF
' Create a PDF from a URL using a PNG image
Dim html As String = "<img src='https://example.com/logo.png'>"
Dim renderer As New ChromePdfRenderer()
' Render HTML to PDF
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(html)
' Access the first image object on the first page
Dim image As ImageObject = pdf.Pages.First().ObjectModel.ImageObjects.FirstOrDefault()
' To scale the image to 150% of its original size uniformly
image.Scale = New System.Drawing.PointF(1.5F, 1.5F)
' Save the PDF with the scaled image
pdf.SaveAs("scaled_image.pdf")Remove PDF Objects
Delete unnecessary or unwanted PDF objects from your document to clean up and streamline your content.
Learn how to:remove PDF DOM objectsusing IronSoftware;
using IronSoftware.Pdfium.Dom;
using System.Linq;
// Load a PDF file
PdfDocument pdf = PdfDocument.FromFile("sampleObjectsWithImages.pdf");
// Access DOM Objects
IPdfPageObjectModel objects = pdf.Pages.First().ObjectModel;
// Remove first image
objects.ImageObjects.RemoveAt(0);Imports IronSoftware
Imports IronSoftware.Pdfium.Dom
Imports System.Linq
' Load a PDF file
Dim pdf As PdfDocument = PdfDocument.FromFile("sampleObjectsWithImages.pdf")
' Access DOM Objects
Dim objects As IPdfPageObjectModel = pdf.Pages.First().ObjectModel
' Remove first image
objects.ImageObjects.RemoveAt(0)
Modify Multiple Text Segments at Once
Extract PDF Text & Images
Extract text and images from your PDF files, enabling easy reuse or repurposing of content for other documents or applications.
Learn how to:extract text and imagesusing IronPdf;
using System.IO;
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Extract text
string text = pdf.ExtractAllText();
// Export the extracted text to a text file
File.WriteAllText("extractedText.txt", text);Imports IronPdf
Imports System.IO
Dim pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Extract text
Dim text As String = pdf.ExtractAllText()
' Export the extracted text to a text file
File.WriteAllText("extractedText.txt", text)Redact Text
Protect sensitive information by redacting text within your PDF. Permanently remove or obscure text to maintain document confidentiality.
Learn how to:redact textusing IronPdf;
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");
// Redact 'Alaric' phrase from all pages
pdf.RedactTextOnAllPages("Alaric");
pdf.SaveAs("redacted.pdf");Imports IronPdf
Dim pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")
' Redact 'Alaric' phrase from all pages
pdf.RedactTextOnAllPages("Alaric")
pdf.SaveAs("redacted.pdf")Find and Replace Text
Quickly find and replace text throughout your entire PDF document, making content updates and corrections efficient and error-free.
Learn how to:find and replace textusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>.NET6</h1>");
string oldText = ".NET6";
string newText = ".NET7";
// Replace text on all pages
pdf.ReplaceTextOnAllPages(oldText, newText);
pdf.SaveAs("replaceText.pdf");Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>.NET6</h1>")
Dim oldText As String = ".NET6"
Dim newText As String = ".NET7"
' Replace text on all pages
pdf.ReplaceTextOnAllPages(oldText, newText)
pdf.SaveAs("replaceText.pdf")
Advocate Robust PDF Design Enhancements
Annotations
Add annotations to your PDF files, such as comments, highlights, or notes, to provide additional context or emphasize specific sections.
Learn how to:control PDF annotationsusing IronPdf;
using IronPdf.Annotations;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Annotation</h1>");
// Create a PDF annotation object on a specified page index
TextAnnotation annotation = new TextAnnotation(0)
{
Title = "This is the title",
Contents = "This is the long 'sticky note' comment content...",
X = 50,
Y = 700,
};
// Add the annotation
pdf.Annotations.Add(annotation);
pdf.SaveAs("annotation.pdf");Imports IronPdf
Imports IronPdf.Annotations
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Annotation</h1>")
' Create a PDF annotation object on a specified page index
Dim annotation As New TextAnnotation(0) With {
.Title = "This is the title",
.Contents = "This is the long 'sticky note' comment content...",
.X = 50,
.Y = 700
}
' Add the annotation
pdf.Annotations.Add(annotation)
pdf.SaveAs("annotation.pdf")Stamp Texts & Images
Apply custom text or image stamps to your PDFs for branding, approvals, or special markings, enhancing document professionalism and clarity.
Learn how to:stamp texts and imagesusing IronPdf;
using IronPdf.Editing;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");
// Create text stamper
TextStamper textStamper = new TextStamper()
{
Text = "Text Stamper!",
FontFamily = "Bungee Spice",
UseGoogleFont = true,
FontSize = 30,
IsBold = true,
IsItalic = true,
VerticalAlignment = VerticalAlignment.Top,
};
// Stamp the text stamper
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");Imports IronPdf
Imports IronPdf.Editing
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")
' Create text stamper
Dim textStamper As New TextStamper() With {
.Text = "Text Stamper!",
.FontFamily = "Bungee Spice",
.UseGoogleFont = True,
.FontSize = 30,
.IsBold = True,
.IsItalic = True,
.VerticalAlignment = VerticalAlignment.Top
}
' Stamp the text stamper
pdf.ApplyStamp(textStamper)
pdf.SaveAs("stampText.pdf")Custom Watermark
Create and apply custom watermarks to your PDF documents to mark them as drafts, confidential, or to add branding elements.
Learn how to:create watermarkusing IronPdf;
string watermarkHtml = @"
<img src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
";
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>");
// Apply watermark
pdf.ApplyWatermark(watermarkHtml);
pdf.SaveAs("watermark.pdf");Imports IronPdf
Dim watermarkHtml As String = "
<img src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
"
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>")
' Apply watermark
pdf.ApplyWatermark(watermarkHtml)
pdf.SaveAs("watermark.pdf")Draw Text & Bitmap
Add custom text and bitmap images to your PDFs, giving you the freedom to include unique content elements tailored to your document's needs.
Learn how to:draw text and bitmapusing 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);
// Open the image from file
AnyBitmap bitmap = AnyBitmap.FromFile("ironSoftware.png");
// Draw the bitmp on PDF
pdf.DrawBitmap(bitmap, 0, 50, 250, 500, 300);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, 12, 0, 100, 100, Color.Black, 0)
' 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)Draw Line and Rectangle
Insert lines and rectangles into your PDF to structure content, emphasize sections, or create diagrams.
Learn how to:convert rectangleusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");
// Configure the required parameters
int pageIndex = 0;
var start = new IronSoftware.Drawing.PointF(200,150);
var end = new IronSoftware.Drawing.PointF(1000,150);
int width = 10;
var color = new IronSoftware.Drawing.Color("#000000");
// Draw line on PDF
pdf.DrawLine(pageIndex, start, end, width, color);
pdf.SaveAs("drawLine.pdf");Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")
' Configure the required parameters
Dim pageIndex As Integer = 0
Dim start = New IronSoftware.Drawing.PointF(200, 150)
Dim [end] = New IronSoftware.Drawing.PointF(1000, 150)
Dim width As Integer = 10
Dim color = New IronSoftware.Drawing.Color("#000000")
' Draw line on PDF
pdf.DrawLine(pageIndex, start, [end], width, color)
pdf.SaveAs("drawLine.pdf")Add Page Numbers
Insert page numbers into your PDF, positioning them according to your formatting preferences to maintain an organized document structure.
Learn how to:add page numbersusing IronPdf;
// Create text header
TextHeaderFooter textHeader = new TextHeaderFooter()
{
CenterText = "{page} of {total-pages}"
};
// Render a new PDF
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>");
// Add header and footer
pdf.AddTextHeaders(textHeader);
pdf.SaveAs("pdfWithPageNumber.pdf");Imports IronPdf
' Create text header
Dim textHeader As New TextHeaderFooter() With {
.CenterText = "{page} of {total-pages}"
}
' Render a new PDF
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>")
' Add header and footer
pdf.AddTextHeaders(textHeader)
pdf.SaveAs("pdfWithPageNumber.pdf")Background & Foreground
Control background and foreground elements within your PDF to highlight specific content, enhance readability, or add visual appeal.
Learn how to:add background and foregroundusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Main HTML content</h1>");
// Render background
PdfDocument background = renderer.RenderHtmlAsPdf("<body style='background-color: cyan;'></body>");
// Render foreground
PdfDocument foreground = renderer.RenderHtmlAsPdf("<h1 style='transform: rotate(-45deg); opacity: 50%;'>Overlay Watermark</h1>");
// Add background
pdf.AddBackgroundPdf(background);
// Overlay foreground
pdf.AddForegroundOverlayPdf(foreground);Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Main HTML content</h1>")
' Render background
Dim background As PdfDocument = renderer.RenderHtmlAsPdf("<body style='background-color: cyan;'></body>")
' Render foreground
Dim foreground As PdfDocument = renderer.RenderHtmlAsPdf("<h1 style='transform: rotate(-45deg); opacity: 50%;'>Overlay Watermark</h1>")
' Add background
pdf.AddBackgroundPdf(background)
' Overlay foreground
pdf.AddForegroundOverlayPdf(foreground)Ready to Get Started?
Nuget Downloads 21,105,021|Version:2026.9just released