Enum PdfCompressionLevel
- Namespace
- Syncfusion.Pdf
- Assembly
- Syncfusion.Pdf.Portable.dll
Defines data compression level.
public enum PdfCompressionLevel
Fields
AboveNormal = 7
Pack better but require a little more time.
BelowNormal = 3
Something middle between normal and BestSpeed compressions.
Best = 9
Use best compression, slow enough.
BestSpeed = 1
Use high speed compression, reduce of data size is low.
None = 0
Pack without compression.
Normal = 5
Use normal compression, middle between speed and size.
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Create a new page.
PdfPage page = doc.Pages.Add();
//Set document compression level
doc.Compression = PdfCompressionLevel.BestSpeed;
//Obtain PdfGraphics object.
PdfGraphics g = page.Graphics;
//Create font with Bold font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
//Create pen with green color.
PdfPen pen = new PdfPen(System.Drawing.Color.Green);
//Create brush with black color.
PdfBrush brush = new PdfSolidBrush(System.Drawing.Color.Black);
RectangleF rect = new RectangleF(100, 100, 200, 100);
//Draw text in the new page.
g.DrawString("Simple Rectangle", font, PdfBrushes.DarkBlue, new PointF(310, 255));
//Draw rectangle in the new page.
g.DrawRectangle(pen, brush, rect);
//Save the document.
doc.Save("CompressionLevel.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As PdfDocument = New PdfDocument()
'Creates a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set document compression level.
doc.Compression = PdfCompressionLevel.BestSpeed
'Obtain PdfGraphics object.
Dim g As PdfGraphics = page.Graphics
'Create font with Bold font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
'Create pen with green color.
Dim pen As PdfPen = New PdfPen(System.Drawing.Color.Green)
'Create brush with black color.
Dim brush As PdfBrush = New PdfSolidBrush(System.Drawing.Color.Black)
Dim rect As RectangleF = New RectangleF(100, 100, 200, 100)
'Draw text in the new page.
g.DrawString("Simple Rectangle", font, PdfBrushes.DarkBlue, New PointF(310, 255))
'Draw rectangle in the new page.
g.DrawRectangle(pen, brush, rect)
'Save document to disk.
doc.Save("CompressionLevel.pdf")
'Close the document.
doc.Close(True)
Remarks
Default value is Normal.