Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
Adobe's Portable Document Format (PDF) is widely used in various industries for tasks such as creating invoices. Developers also use the PDF format to produce documents that meet client specifications. Libraries have simplified the process of creating PDFs, and when selecting a library for a project, consider features like build, read, and convert capabilities.
IronPDF is a robust PDF SDK framework that facilitates the creation, reading, and editing of PDF documents. It converts HTML to PDF using the Chrome engine and supports various web components like Xamarin, Blazor, Unity, HoloLens apps, and more. It works with both online applications and traditional Windows Applications. IronPDF allows for the creation of aesthetically pleasing PDFs using HTML5, JavaScript, CSS, and images, and includes a powerful HTML-to-PDF converter.
IronPDF makes it easy to create PDFs from images.
Dim pdfdoc = ImageToPdfConverter.ImageToPdf("test.png").SaveAs("Resultimage.pdf")
Dim pdfdoc = ImageToPdfConverter.ImageToPdf("test.png").SaveAs("Resultimage.pdf")
By using the ImageToPdfConverter
class, it is easy to use without creating any object for the class. The ImageToPdf
method accepts the filename and path as a parameter and converts the given PNG file into the desired PDF. Finally, the SaveAs
saves the generated PDF file in the desired location.
The below image shows the result of the above code.
The PDF file output
This next example creates a PDF document from a list of images.
Dim lstimages As List(Of String) = New List(Of String)
lstimages.Add("test.png") lstimages.Add("demo.png")
Dim pdfdoc = ImageToPdfConverter.ImageToPdf(lstimages).SaveAs("Resultimage.pdf")
Dim lstimages As List(Of String) = New List(Of String)
lstimages.Add("test.png") lstimages.Add("demo.png")
Dim pdfdoc = ImageToPdfConverter.ImageToPdf(lstimages).SaveAs("Resultimage.pdf")
The PDF file from two images
Several bitmap image objects can be converted to PDF files with just a few lines of code.
Imports system.Drawing
Imports IronPdf
Dim image = Bitmap.FromFile("test.png")
Dim doc = ImageToPdfConverter.ImageToPdf(image).SaveAs("Resultimage.pdf")
Imports system.Drawing
Imports IronPdf
Dim image = Bitmap.FromFile("test.png")
Dim doc = ImageToPdfConverter.ImageToPdf(image).SaveAs("Resultimage.pdf")
In the example above, a Bitmap object is created from the PNG file and used as a medium format to convert to a PDF file.
Generate a PDF file from a PNG image
It is also possible to combine a collection (or List) of Bitmap
objects into a single PDF:
Dim lstimages As List(Of IronSoftware.Drawing.AnyBitmap) = New List(Of IronSoftware.Drawing.AnyBitmap)
lstimages.Add(Bitmap.FromFile("test.png"))
lstimages.Add(Bitmap.FromFile("demo.png"))
Dim pdfdoc = ImageToPdfConverter.ImageToPdf(lstimages).SaveAs("Resultimage.pdf")
Dim lstimages As List(Of IronSoftware.Drawing.AnyBitmap) = New List(Of IronSoftware.Drawing.AnyBitmap)
lstimages.Add(Bitmap.FromFile("test.png"))
lstimages.Add(Bitmap.FromFile("demo.png"))
Dim pdfdoc = ImageToPdfConverter.ImageToPdf(lstimages).SaveAs("Resultimage.pdf")
Combine multiple Bitmap files to generate a PDF file
Configure the behavior of the above method calls using a ChromePdfRenderOptions
object aids to enhance the visual aspect of the output PDF file. Options that can be configured include the position of the image, header and footer formatting, page title, page size, and many others.
More information about adding images to PDFs using IronPDF, along with other information, can be found in the IronPDF Documentation.
The IronPDF library provides a free license for development and a variety of licenses are available for purchase for use in a production environment, depending on the developer's needs. The Lite package costs $749 upfront and has no ongoing expenses. The licenses come with a perpetual license, a year of product support, upgrades, and options for SaaS and OEM redistribution. They are one-time investments that can be utilized for production, staging, and development.
IronPDF also provides extra time-limited free licenses. In addition, IronPDF offers free licenses that prevent redistribution. To view IronPDF's complete pricing and licensing details, please visit the IronPDF Licensing Details.
9 .NET API products for your office documents