Users can transform images from local file and stream. And following two examples will introduce how to convert image to PDF document using vb.net sample code.
The first example shows convert BMP images from the disk to PDF stream.
Imports System.IO Imports PQScan.ImageToPDF Namespace ImageToPDF Class Program Private Shared Sub Main(args As String()) 'Create an instance of PQScan.ImageToPDF.PDFConverter object. Dim converter As New PDFConverter() 'Set PDF page layout, if to ImageSize, 'PDF page will display the original size and quality of the source image. converter.PageSizeType = PageSizeMode.ImageSize 'Set input image from local files. Dim imgFiles As String() = New String(2) {"input1.bmp", "input2.bmp", "input3.bmp"} 'Set output pdf stream. Dim fileStream As New FileStream("bmp-to-pdf.pdf", FileMode.Create) 'Generate PDF from images. converter.CreatePDF(imgFiles, fileStream) End Sub End Class End Namespace
The second guide is demonstrating how to convert GIF image from file stream to PDF stream in vb.net.
Imports System.IO Imports PQScan.ImageToPDF Namespace ImageToPDF Class Program Private Shared Sub Main(args As String()) 'Create an instance of PQScan.ImageToPDF.PDFConverter object. Dim converter As New PDFConverter() 'Set PDF page layout, A4 is most widely used. converter.PageSizeType = PageSizeMode.A4 'Set input image from file streams. Dim streams As FileStream() = New FileStream(2) {} streams(0) = New FileStream("input1.gif", FileMode.Open) streams(1) = New FileStream("input2.gif", FileMode.Open) streams(2) = New FileStream("input3.gif", FileMode.Open) 'Set output pdf file stream. Dim fileStream As New FileStream("gif-to-pdf.pdf", FileMode.Create) 'Generate PDF from images. converter.CreatePDF(imgFiles, fileStream) End Sub End Class End Namespace