IRONSOFTWAREHOME
Translate PDF Objects in C#
using IronPdf;
using System.Linq;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render simple HTML to PDF
PdfDocument pdf = renderer.RenderHtmlAsPdf("Test");

// Access the first text object on the first page
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);

// Save the modified PDF
pdf.SaveAs("translated.pdf");
Imports IronPdf
Imports System.Linq

Dim renderer As New ChromePdfRenderer()

' Render simple HTML to PDF
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("Test")

' Access the first text object on the first page
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)

' Save the modified PDF
pdf.SaveAs("translated.pdf")
NuGet Download
PM > Install-Package IronPdf
Translate PDF Objects in C#

Translate PDF Objects in C#

There are times when users need to move a particular text, image, or shape within a PDF to another location. With IronPDF, we offer ways for developers to directly access a PDF object and translate it using our library.

Within this code example, we'll go through how you can translate objects with the PDF DOM easily with IronPDF.

Code Explanation

We first instantiate a ChromePdfRenderer and then call RenderHtmlAsPdf to render an HTML string into a PDF.

After rendering the text, we then access the PDF DOM object collection. We get the first page using Pages.First, then access its ObjectModel to find the TextObjects collection. The TextObjects collection holds all TextObject instances within the PDF. We access the first element in this collection and assign it to the variable.

After obtaining the first TextObject within the PDF (in our example, this would be the word "Test"), we then assign a new PointF(X, Y) to the Translate property. By assigning a new point, the position of the word shifts 100 points to the right and 100 points down along the X and Y axes.

Finally, after the text has been moved, we utilize the SaveAs method to save the modified PDF.

Discover How to Effortlessly Translate PDF DOM - Visit Our Guide Now!
View on GitHub

Ready to Get Started?

Nuget Downloads 20,878,335Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required