Enum PdfGraphicsUnit
- Namespace
- Syncfusion.Pdf.Graphics
- Assembly
- Syncfusion.Pdf.Portable.dll
Specifies the types of the page's logical units.
public enum PdfGraphicsUnit
Fields
Centimeter = 0
Specifies the Measurement is in centimeters.
Document = 5
Specifies the document unit (1/300 inch) as the unit of measure.
Inch = 4
Specifies the inch as the unit of measure.
Millimeter = 6
Specifies the Measurement is in millimeters.
Pica = 1
Specifies the Measurement is in picas. A pica represents 12 points.
Pixel = 2
Specifies the unit of measurement is 1 pixel.
Point = 3
Specifies a printer's point (1/72 inch) as the unit of measure.
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create new PDF unitconverter.
PdfUnitConvertor converter = new PdfUnitConvertor();
//Convert to pixels.
RectangleF rect = converter.ConvertToPixels(new RectangleF(100, 100, 200, 100), PdfGraphicsUnit.Point);
page.Graphics.DrawRectangle(PdfPens.Red, rect);
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF unitconverter.
Dim converter As New PdfUnitConvertor()
'Convert to pixels.
Dim rect As RectangleF = converter.ConvertToPixels(New RectangleF(100, 100, 200, 100), PdfGraphicsUnit.Point)
page.Graphics.DrawRectangle(PdfPens.Red, rect)
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)