ByteScout PDF Suite - VB.NET - Pdf to image rendering in background thread with pdf renderer sdk - ByteScout

ByteScout PDF Suite – VB.NET – Pdf to image rendering in background thread with pdf renderer sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – VB.NET – Pdf to image rendering in background thread with pdf renderer sdk

pdf to image rendering in background thread with pdf renderer sdk in VB.NET using ByteScout PDF Suite

How to apply ByteScout PDF Suite for pdf to image rendering in background thread with pdf renderer sdk in VB.NET

The example source codes on this page will display you how to make pdf to image rendering in background thread with pdf renderer sdk in VB.NET. ByteScout PDF Suite was created to assist pdf to image rendering in background thread with pdf renderer sdk in VB.NET. ByteScout PDF Suite is the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript.

The below SDK samples describe how to quickly make your application do pdf to image rendering in background thread with pdf renderer sdk in VB.NET with the help of ByteScout PDF Suite. Follow the steps-by-step instructions from the scratch to work and copy and paste code for VB.NET into your editor. This basic programming language sample code for VB.NET will do the whole work for you in implementing pdf to image rendering in background thread with pdf renderer sdk in your app.

Trial version can be downloaded from our website for free. It contains 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 Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

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

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next