Documents for Excel .NET Edition | GCDocuments
File Operations / Export to PDF / Control Image Quality
In This Topic
    Control Image Quality
    In This Topic

    GcExcel enables users to control the quality of images while exporting them to PDF documents. The ImageQuality property of PdfSaveOptions class can be used for the same. The property takes percentage values and its default value is 75. However, it can vary between 0 to 100, depicting the below behavior:

    Value Image Quality Image Compression
    0 Lowest Maximum
    100 Highest Nil

    Using Code

    Refer to the following example code to export an image to PDF with highest image quality.

    C#
    Copy Code
    // Initialize workbook
    Workbook workbook = new Workbook();
    // Fetch default worksheet
    IWorksheet worksheet = workbook.Worksheets[0];
    
    //Add a picture
    worksheet.Shapes.AddPictureInPixel("Logo.png", 0, 0, 639, 578);
    
    //Create PdfSaveOptions
    PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
    
    //Set image quality as 100 % (highest quality)
    pdfSaveOptions.ImageQuality = 100;
    
    //Save to pdf with PdfSaveOptions
    workbook.Save("LogoInPDF.pdf", pdfSaveOptions);