// Create a pdf file stream using FileStream outputStream = new FileStream("SetImageQuality.pdf", FileMode.Create); //create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; System.IO.Stream stream = this.GetResourceStream("C1Weather.png"); GrapeCity.Documents.Excel.Drawing.IShape picture = worksheet.Shapes.AddPictureInPixel(stream, GrapeCity.Documents.Excel.Drawing.ImageType.PNG, 0, 0, 600, 310); // Create PdfSaveOptions PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); // Set image quality as 100%(highest quality) pdfSaveOptions.ImageQuality = 100; //Save the workbook into pdf file. workbook.Save(outputStream, pdfSaveOptions);
' Create a pdf file stream Dim outputStream = File.Create("SetImageQuality.pdf") ' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim stream As Stream = GetResourceStream("C1Weather.png") Dim picture As IShape = worksheet.Shapes.AddPictureInPixel(stream, ImageType.PNG, 0, 0, 600, 310) ' Create PdfSaveOptions ' Set image quality as 100%(highest quality) Dim pdfSaveOptions As New PdfSaveOptions With { .ImageQuality = 100 } 'Save the workbook into pdf file. workbook.Save(outputStream, pdfSaveOptions)