PDF to TIFF SDK tutorial - C# and VB.NET source codes - ByteScout

PDF to TIFF SDK tutorial – C# and VB.NET source codes

  • Home
  • /
  • Articles
  • /
  • PDF to TIFF SDK tutorial – C# and VB.NET source codes

PDF2TIFF SDK tutorial shows how to convert PDF to TIFF image file in C# or Visual Basic .NET with PDF Renderer SDK.

C#

using System;

using Bytescout.PDFRenderer;

namespace PDF2TIFF
{
class Program
{
static void Main(string[] args)
{
// Create an instance of Bytescout.PDFRenderer.RasterRenderer object and register it.
RasterRenderer renderer = new RasterRenderer();
renderer.RegistrationName = “demo”;
renderer.RegistrationKey = “demo”;

// Load PDF document.
renderer.LoadDocumentFromFile(“multipage.pdf”);

for (int i = 0; i < renderer.GetPageCount(); i++) { // Render first page of the document to TIFF image file. renderer.RenderPageToFile(i, RasterOutputFormat.TIFF, "image" + i + ".tif"); } // Open the first output file in default image viewer. System.Diagnostics.Process.Start("image0.tif"); } } }[/vb]

VB.NET

Imports Bytescout.PDFRenderer


Class Program
Friend Shared Sub Main(args As String())

       ' 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")

       ' define page to start from
       Dim StartPageIndex As Integer = 0
       ' define page to end on
       Dim EndPageIndex As Integer = renderer.GetPageCount() - 1

       ' Render PDF to TIFF image file.
       renderer.RenderPageRangeToMultipageTIFFFile(StartPageIndex, EndPageIndex, TIFFCompression.LZW, "multipage.tiff")

       ' Open the first output file in default image viewer.
       System.Diagnostics.Process.Start("multipage.tiff")
End Sub
End Class

Tutorials:

prev
next