ByteScout PDF Renderer SDK - VB.NET - PDF To Image Rendering In Background Thread - ByteScout

ByteScout PDF Renderer SDK – VB.NET – PDF To Image Rendering In Background Thread

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Renderer SDK – VB.NET – PDF To Image Rendering In Background Thread

PDF to image rendering in background thread in VB.NET with ByteScout PDF Renderer SDK

Make PDF to image rendering in background thread in VB.NET

:

Tutorial on how to do PDF to image rendering in background thread in VB.NET

ByteScout tutorials explain the material for programmers who use VB.NET. ByteScout PDF Renderer SDK was made to help with PDF to image rendering in background thread in VB.NET. ByteScout PDF Renderer SDK is the library that renders PDF into high quality images and thumbnails. Includes various functions like batch processing, PNG, TIFF output. Can be used from web and desktop applications.

VB.NET code snippet like this for ByteScout PDF Renderer SDK works best when you need to quickly implement PDF to image rendering in background thread in your VB.NET application. This VB.NET sample code should be copied and pasted into your application’s code editor. Then just compile and run it to see how it works. Enjoy writing a code with ready-to-use sample VB.NET codes to add PDF to image rendering in background thread functions using ByteScout PDF Renderer SDK in VB.NET.

Trial version can be obtained from our website for free. It includes this and other source code samples for VB.NET.

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.IO Imports System.Threading Imports Bytescout.PDFRenderer Class Program Private Shared _doneEvent As New ManualResetEvent(False) ' synchronization event Private Shared _counter As Integer ' thread counter Friend Shared Sub Main(args As String()) ' Get all PDF files in current directory Dim pdfFiles As String() = Directory.GetFiles(".", "*.pdf") _counter = pdfFiles.Length ' Render PDF files in separate threads For Each pdfFile As String In pdfFiles Dim backgroundThread As New Thread(AddressOf BackgroundThreadProc) backgroundThread.Start(pdfFile) Console.WriteLine(pdfFile & " - conversion started.") Next ' Wait until threads finished _doneEvent.WaitOne() Console.WriteLine("Done.") Console.WriteLine() Console.WriteLine("Press any key to continue...") Console.ReadKey() End Sub ' Rendering thread function Private Shared Sub BackgroundThreadProc(data As Object) Dim fileName As String = DirectCast(data, String) Try ' Create renderer Using renderer As New RasterRenderer() renderer.LoadDocumentFromFile(fileName) ' Setup rendering Dim renderingOptions As New RenderingOptions() renderingOptions.JPEGQuality = 90 Dim renderingResolution As Single = 300 ' Render document pages For i As Integer = 0 To renderer.GetPageCount() - 1 renderer.Save(fileName & ".page" & i & ".jpg", RasterImageFormat.JPEG, i, renderingResolution, renderingOptions) Next End Using Console.WriteLine(fileName & " - successfully converted.") Catch exception As Exception Console.WriteLine(exception.ToString()) End Try If Interlocked.Decrement(_counter) = 0 Then ' Set event if all threads finished _doneEvent.Set() End If End Sub End Class

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Renderer SDK Home Page

Explore ByteScout PDF Renderer SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Renderer SDK 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 PDF Renderer SDK Home Page

Explore ByteScout PDF Renderer SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Renderer SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next