usmanazizgroupdocs
5/25/2017 - 11:46 AM

RenderDocumentAsPDFWithJpegQualitySettings.vb

' For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
' Create/initialize image handler 
Dim imageHandler As New ViewerImageHandler(Utilities.GetConfigurations())

' Set pdf options JpegQuality in a range between 1 and 100
Dim PdfFileOptions As New PdfFileOptions()
PdfFileOptions.JpegQuality = 5

' Call GetPdfFile to get FileContainer type object which contains the stream of pdf file.
Dim container As FileContainer = imageHandler.GetPdfFile(DocumentName, PdfFileOptions)

'Change the extension of the file and assign to a string type variable filename
Dim filename As [String] = Path.GetFileNameWithoutExtension(DocumentName) + ".pdf"

'Save each image at disk
Utilities.SaveFile(filename, container.Stream)