The code below will help you to implement an VB.NET app to insert images in PDF. ByteScout PDF SDK is the component to help programmers in generating new pdf files, modifying and updating existing pdf documents or pdf forms. Provides support for auto-filling pdf forms, adding text with adjustable font, style, size, font family, new form fields, vector and raster drawings. It can insert images in PDF in VB.NET.
You will save a lot of time on writing and testing code as you may just take the VB.NET code from ByteScout PDF SDK for insert images in PDF below and use it in your application. In your VB.NET project or application you may simply copy & paste the code and then run your app! Use of ByteScout PDF SDK in VB.NET is also explained in the documentation included along with the product.
Trial version of ByteScout PDF SDK can be downloaded for free from our website. It also includes source code samples for VB.NET and other programming languages.
Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to add images of various formats. ''' </summary> Class Program Shared Sub Main() ' Create new document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" ' Add page Dim page = New Page(PaperFormat.A4) pdfDocument.Pages.Add(page) Dim canvas = page.Canvas ' Add JPEG image and draw unscaled Dim image1 = New Image("Image1.jpg") canvas.DrawImage(image1, 20, 20) ' Add PNG image and draw reduced twice Dim image2 = New Image("Image2.png") canvas.DrawImage(image2, 20, 520, image2.Width / 2, image2.Height / 2) ' Add TIFF image and draw scaled disproportionately Dim image3 = New Image("Image3.tif") canvas.DrawImage(image3, 270, 520, image3.Width / 2, image3.Height / 4) ' Add GIF image and draw rotated 90 degrees and scaled Dim image4 = New Image("Image4.gif") canvas.TranslateTransform(390, 650) canvas.RotateTransform(90) canvas.DrawImage(image4, 0, 0, image4.Width / 4, image4.Height / 4) ' Save document to file pdfDocument.Save("result.pdf") ' Cleanup pdfDocument.Dispose() ' Open document in default PDF viewer app Process.Start("result.pdf") End Sub End Class