GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / AddRotationAt Method
The rotation angle, in degrees, determining the counterclockwise rotation. It must be an integer value from 0 to 360, otherwise the method will fail.
The horizontal (X) coordinate of the rotation's center point, expressed in the current units specified by the SetMeasurementUnit method, related to the currently selected page.
The vertical (Y) coordinate of the rotation's center point, expressed in the current units specified by the SetMeasurementUnit method, related to the currently selected page.
Example





In This Topic
AddRotationAt Method (GdPicturePDF)
In This Topic
Modifies the current transformation matrix (CTM) applying a counterclockwise rotation by a required angle around a specified point, in other words the current coordinate system axes are rotated by this angle counterclockwise. The rotation angle needs to be defined within the interval from 0 to 360. The rotation's center point needs to be expressed in the current units defined in the PDF document, related to the actual page. The applied rotation affects all subsequent drawing operations on the currently selected page of the loaded PDF document.

The CTM parameter is part of the graphics state parameters. These parameters are initialized to their default values at the beginning of each page (see PDF Reference, Section "Graphics State").

You can use the GetMeasurementUnit method to determine the currently defined units and you can use the SetMeasurementUnit method to reset the units according to your preference.

Syntax
'Declaration
 
Public Function AddRotationAt( _
   ByVal Angle As Single, _
   ByVal AtX As Single, _
   ByVal AtY As Single _
) As GdPictureStatus
public GdPictureStatus AddRotationAt( 
   float Angle,
   float AtX,
   float AtY
)
public function AddRotationAt( 
    Angle: Single;
    AtX: Single;
    AtY: Single
): GdPictureStatus; 
public function AddRotationAt( 
   Angle : float,
   AtX : float,
   AtY : float
) : GdPictureStatus;
public: GdPictureStatus AddRotationAt( 
   float Angle,
   float AtX,
   float AtY
) 
public:
GdPictureStatus AddRotationAt( 
   float Angle,
   float AtX,
   float AtY
) 

Parameters

Angle
The rotation angle, in degrees, determining the counterclockwise rotation. It must be an integer value from 0 to 360, otherwise the method will fail.
AtX
The horizontal (X) coordinate of the rotation's center point, expressed in the current units specified by the SetMeasurementUnit method, related to the currently selected page.
AtY
The vertical (Y) coordinate of the rotation's center point, expressed in the current units specified by the SetMeasurementUnit method, related to the currently selected page.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.

Be aware also that graphics state parameters are initialized to their default values at the beginning of each page.

Example
How to draw text onto a new page using the rotation of a current transformation matrix.
Dim caption As String = "Example: AddRotationAt"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
    Dim fontName As String = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelvetica)
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.SetTextSize(100) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.SetFillColor(255, 0, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.AddRotationAt(45, 50, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawText(fontName, 50, 0, "GdPicturePDF") = GdPictureStatus.OK) Then
            status = gdpicturePDF.SaveToFile("test_AddRotationAt.pdf")
            If status = GdPictureStatus.OK Then
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
            Else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The example has not been followed successfully." + vbCrLf + "The last known status is " + gdpicturePDF.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The AddStandardFont() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: AddRotationAt";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
    string fontName = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelvetica);
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
            (gdpicturePDF.SetTextSize(100) == GdPictureStatus.OK) &&
            (gdpicturePDF.SetFillColor(255, 0, 0) == GdPictureStatus.OK) &&
            (gdpicturePDF.AddRotationAt(45, 50, 0) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawText(fontName, 50, 0, "GdPicturePDF") == GdPictureStatus.OK))
        {
            status = gdpicturePDF.SaveToFile("test_AddRotationAt.pdf");
            if (status == GdPictureStatus.OK)
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
            else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("The example has not been followed successfully.\nThe last known status is " + gdpicturePDF.GetStat().ToString(), caption);
    }
    else
        MessageBox.Show("The AddStandardFont() method has failed with the status: " + status.ToString(), caption);
}
else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();
See Also