Skip to main content

PdfGraphics.ScaleTransform(Single, Single) Method

Scales the coordinate system by the specified scale factor.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.1.Drawing.dll

NuGet Package: DevExpress.Pdf.Drawing


public void ScaleTransform(
    float sx,
    float sy


Name Type Description
sx Single

Scale factor in the x direction.

sy Single

Scale factor in the y direction.


This method multiplies the transformation matrix of the PdfGraphics object by a scaling matrix. The scaling matrix is a diagonal matrix that includes the sx and sy parameters.


The code sample below scales the coordinate system and draws shapes in the initial and scaled coordinate systems.

Scale the Coordinate System

using DevExpress.Pdf;
using System.Drawing;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
    PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
        using (PdfGraphics graphics = processor.CreateGraphics()) {
            var rectangle = new RectangleF(0, 0, 300, 300);

            // Draw a blue square.
            using (var brush = new SolidBrush(Color.Blue))
                graphics.FillRectangle(brush, rectangle);

            // Scale the coordinate system.
            graphics.ScaleTransform(0.5f, 0.5f);

            // Draw a red square in the scaled coordinate system.
            using (var brush = new SolidBrush(Color.Red))
                graphics.FillRectangle(brush, rectangle);

            // Add graphics content to the document page.
            graphics.AddToPageForeground(page, 72, 72);
See Also