XTransform Magnify Function. Scale about a locked anchor point. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Scale about a locked anchor point.

 

   
Syntax  

[C#]
void Magnify(double scaleX, double scaleY, double anchorX, double anchorY)

[Visual Basic]
Sub Magnify(scaleX As Double, scaleY As Double, anchorX As Double, anchorY As Double)

 

   

Params
 
Name Description
scaleX The amount of horizontal scaling to apply.
scaleY The amount of vertical scaling to apply.
anchorX The horizontal coordinate about which the stretch should be applied.
anchorY The vertical coordinate about which the stretch should be applied.

 

   

Notes
 

This method stretches the world space about a locked anchor point. Different degrees of horizontal and vertical stretch can be used.

Another way of looking at this kind of transform is as a zoom. The anchor point is the location you're zooming in on and the scale factors indicate the level of zoom.

 

   

Example
 

Here we add two chunks of text. The default text is added in black and the magnified text is drawn in red. We specify the middle of the document as the anchor point which means that all scaling is relative to the middle of the document. Our horizontal scale factor is larger than our text has been stretched horizontally somewhat.

[C#]
Doc theDoc = new Doc();
theDoc.Rect.Inset(200, 200);
theDoc.FontSize = 48;
theDoc.AddText("Normal");
theDoc.FrameRect();
theDoc.Rect.Move(0, -100);
theDoc.Color.String = "255 0 0";
theDoc.Transform.Magnify(2, 1.5, 302, 396);
theDoc.AddText("Magnified");
theDoc.FrameRect();
theDoc.Save(Server.MapPath("transformmagnify.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Rect.Inset(200, 200)
theDoc.FontSize = 48
theDoc.AddText("Normal")
theDoc.FrameRect()
theDoc.Rect.Move(0, -100)
theDoc.Color.String = "255 0 0"
theDoc.Transform.Magnify(2, 1.5, 302, 396)
theDoc.AddText("Magnified")
theDoc.FrameRect()
theDoc.Save(Server.MapPath("transformmagnify.pdf"))
theDoc.Clear()


transformmagnify.pdf