ByteScout Premium Suite - VB.NET - Pdf to image with custom size with pdf renderer sdk - ByteScout

ByteScout Premium Suite – VB.NET – Pdf to image with custom size with pdf renderer sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – VB.NET – Pdf to image with custom size with pdf renderer sdk

pdf to image with custom size with pdf renderer sdk in VB.NET and ByteScout Premium Suite

pdf to image with custom size with pdf renderer sdk in VB.NET

Easy to understand coding instructions are written to assist you to try-out the features without the requirement to write your own code. Pdf to image with custom size with pdf renderer sdk in VB.NET can be applied with ByteScout Premium Suite. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.

Want to speed up the application development? Then this VB.NET, code samples for VB.NET, developers help to speed up the application development and writing a code when using ByteScout Premium Suite. Follow the steps-by-step instructions from the scratch to work and copy and paste code for VB.NET into your editor. Updated and detailed documentation and tutorials are available along with installed ByteScout Premium Suite if you’d like to learn more about the topic and the details of the API.

Our website gives free trial version of ByteScout Premium Suite. It includes all these source code samples with the purpose to assist you with your VB.NET application implementation.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.vb
      
Imports System.Collections.Generic Imports Bytescout.PDFRenderer Class Program Friend Shared Sub Main(args As String()) ' Specify Image Generation Inputs Dim imageGenerationInputs As New ImageGenerationInputs() imageGenerationInputs.AddCustomSize(width:=320, height:=420) imageGenerationInputs.AddCustomSize(width:=600, height:=800) imageGenerationInputs.EnableSaveAsPng = True imageGenerationInputs.EnableSaveAsJpeg = True imageGenerationInputs.EnableSaveAsTiff = True ' Create an instance of Bytescout.PDFRenderer.RasterRenderer object and register it. Dim renderer As New RasterRenderer() renderer.RegistrationName = "demo" renderer.RegistrationKey = "demo" ' Load PDF document. renderer.LoadDocumentFromFile("multipage.pdf") ' Specify Rendering Options to fine tune output generation Dim RenderingOptions As New RenderingOptions() RenderingOptions.TIFFCompression = TIFFCompression.None RenderingOptions.VectorSmoothingMode = GraphicsTransformationQuality.HighQuality ' Loop through each custom size specified For Each itmCustomSize As KeyValuePair(Of Int32, Int32) In imageGenerationInputs.CustomSizes ' Loop through all pages For pageIndex As Integer = 0 To renderer.GetPageCount() - 1 ' Perform save as PNG, if specified If imageGenerationInputs.EnableSaveAsPng Then Dim pngImageName As String = {code}quot;output_{itmCustomSize.Key}x{itmCustomSize.Value}_page{pageIndex + 1}.png" ' Save png image per page, per custom size renderer.Save( destFileName:=pngImageName, outputFormat:=RasterImageFormat.PNG, pageIndex:=pageIndex, width:=itmCustomSize.Key, height:=itmCustomSize.Value, renderingOptions:=RenderingOptions ) Console.WriteLine(pngImageName + " - Generated") End If ' Perform save as JPG, if specified If imageGenerationInputs.EnableSaveAsJpeg Then Dim jpgImageName As String = {code}quot;output_{itmCustomSize.Key}x{itmCustomSize.Value}_page{pageIndex + 1}.jpg" ' Save jpg image per page, per custom size renderer.Save( destFileName:=jpgImageName, outputFormat:=RasterImageFormat.JPEG, pageIndex:=pageIndex, width:=itmCustomSize.Key, height:=itmCustomSize.Value, renderingOptions:=RenderingOptions ) Console.WriteLine(jpgImageName + " - Generated") End If Next ' Perform save as TIFF, if specified If imageGenerationInputs.EnableSaveAsTiff Then Dim tiffImageName As String = {code}quot;output_{itmCustomSize.Key}x{itmCustomSize.Value}.tiff" ' Save tiff image per page, per custom size renderer.SaveMultipageTiff( destFileName:=tiffImageName, startPageIndex:=0, endPageIndex:=renderer.GetPageCount() - 1, width:=itmCustomSize.Key, height:=itmCustomSize.Value, renderingOptions:=RenderingOptions) Console.WriteLine(tiffImageName + " - Generated") End If Next ' Cleanup renderer.Dispose() Console.ReadLine() End Sub End Class Class ImageGenerationInputs #Region "Constructors" Public Sub New() CustomSizes = New List(Of KeyValuePair(Of Integer, Integer))() EnableSaveAsPng = True End Sub #End Region #Region "Properties" Public Property CustomSizes As List(Of KeyValuePair(Of Int32, Int32)) Public Property EnableSaveAsPng As Boolean Public Property EnableSaveAsJpeg As Boolean Public Property EnableSaveAsTiff As Boolean #End Region #Region "Methods" Public Sub AddCustomSize(ByVal width As Int32, ByVal height As Int32) CustomSizes.Add(New KeyValuePair(Of Integer, Integer)(width, height)) End Sub #End Region End Class

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next