Doc Transform Property. The current transformation for drawing. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Read Only Description
[C#] XTransform

[Visual Basic]
XTransform
No transformation. No The current transformation for drawing.

 

   

Notes
 

This property determines the current world space transform. It affects any drawing using the AddText, AddImage, AddLine, FrameRect and FillRect methods.

Transforms are general operations which encompass rotation, translation, magnification and skewing or a combination of these. Note that the order in which transforms are applied is significant: a rotation followed by a translation is not the same as a translation followed by a rotation.

A world space transform is not same an object transform. You are changing the coordinate system - not the objects you're inserting.

Note that transforms operate on the underlying PDF coordinate space rather than any abstraction specified by the Units and TopDown properties. If you are using transforms you will find it easiest to work in the native PDF coordinate space.

 

   

Example
 

The following code creates a PDF document and adds some text and a rectangle rotated at 45 degrees anti-clockwise around the middle of the document.

[C#]
Doc theDoc = new Doc();
string theText;
theText = "Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur. Hi omnes lingua, institutis, legibus inter se differunt. Gallos ab Aquitanis Garumna flumen, a Belgis Matrona et Sequana dividit.";
theText = theText + "\r\n" + theText + "\r\n" + theText + "\r\n";
theDoc.Rect.Magnify(0.5, 0.5);
theDoc.Rect.Position(151, 198);
theDoc.FrameRect();
theDoc.Transform.Rotate(45, 302, 396);
theDoc.FrameRect();
theDoc.FontSize = 24;
theDoc.AddText(theText);
theDoc.Save(Server.MapPath("doctransform.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
Dim theText As String
theText = "Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur. Hi omnes lingua, institutis, legibus inter se differunt. Gallos ab Aquitanis Garumna flumen, a Belgis Matrona et Sequana dividit."
theText = theText + vbCrLf + theText + vbCrLf + theText + vbCrLf
theDoc.Rect.Magnify(0.5, 0.5)
theDoc.Rect.Position(151, 198)
theDoc.FrameRect()
theDoc.Transform.Rotate(45, 302, 396)
theDoc.FrameRect()
theDoc.FontSize = 24
theDoc.AddText(theText)
theDoc.Save(Server.MapPath("doctransform.pdf"))
theDoc.Clear()


doctransform.pdf