XTransform Translate Function. Translate horizontally and vertically. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Translate horizontally and vertically.

 

   
Syntax  

[C#]
void Translate(double x, double y)

[Visual Basic]
Sub Translate(x As Double, y As Double)

 

   

Params
 
Name Description
x The distance to translate to the right.
y The distance to translate upwards.

 

   

Notes
 

This method shifts the world space a specified distance up and to the right. Objects on the PDF will appear to translate upwards and to the right.

 

   

Example
 

Here we draw two rectangles into our document. The black rectangle is drawn before the translation operation and the red one is drawn after it.

[C#]
Doc theDoc = new Doc();
theDoc.Rect.Width = 200;
theDoc.Rect.Height = 250;
theDoc.Rect.Position(100, 100);
theDoc.Width = 20;
theDoc.FrameRect();
theDoc.Transform.Translate(200, 200);
theDoc.Color.String = "255 0 0"; // red
theDoc.FrameRect();
theDoc.Save(Server.MapPath("transformtranslate.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Rect.Width = 200
theDoc.Rect.Height = 250
theDoc.Rect.Position(100, 100)
theDoc.Width = 20
theDoc.FrameRect()
theDoc.Transform.Translate(200, 200)
theDoc.Color.String = "255 0 0" ' red
theDoc.FrameRect()
theDoc.Save(Server.MapPath("transformtranslate.pdf"))
theDoc.Clear()


transformtranslate.pdf