A Comparison of IronPDF vs SpirePDF

In this comparison video, we explore the differences between Iron PDF and Spire PDF when converting HTML content to PDF using the .NET6 framework. The project begins with the setup of Spire PDF, demonstrating the installation process via the NuGet package manager. Using Spire PDF, the video creator attempts to convert a complex web page into a PDF, only to find that essential elements like logos, background shapes, and code boxes are missing in the output. Spire PDF also fails to load some CSS files and images, leading to an incomplete PDF rendering.

The video then shifts focus to Iron PDF, which is installed similarly through the NuGet package manager. By utilizing the Iron PDF library and its chrome PDF renderer, the video demonstrates a successful conversion of the same web page to PDF. Iron PDF impressively retains all website elements, including logos, images, CSS files, and maintains color fidelity, resulting in a responsive and accurate PDF output.

Upon side-by-side comparison of the PDFs generated by both libraries, Iron PDF clearly emerges as the superior choice, providing a more comprehensive and precise representation of the original HTML page. This comparison aims to help developers decide which PDF library best fits their project requirements, highlighting Iron PDF’s reliable performance and rendering capabilities.

Further Reading: A Comparison of IronPDF vs SpirePDF

// Example of using IronPDF to convert HTML string to PDF
using IronPdf;

class Program
{
    static void Main(string[] args)
    {
        // Create a new PdfDocument from an HTML string
        var Renderer = new HtmlToPdf();

        // Convert HTML string to PDF
        PdfDocument pdf = Renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>");

        // Save the PDF document to a file
        pdf.SaveAs("hello-world.pdf");

        // Output file location
        System.Console.WriteLine("PDF file created successfully at: hello-world.pdf");
    }
}
// Example of using IronPDF to convert HTML string to PDF
using IronPdf;

class Program
{
    static void Main(string[] args)
    {
        // Create a new PdfDocument from an HTML string
        var Renderer = new HtmlToPdf();

        // Convert HTML string to PDF
        PdfDocument pdf = Renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>");

        // Save the PDF document to a file
        pdf.SaveAs("hello-world.pdf");

        // Output file location
        System.Console.WriteLine("PDF file created successfully at: hello-world.pdf");
    }
}
' Example of using IronPDF to convert HTML string to PDF
Imports IronPdf

Friend Class Program
	Shared Sub Main(ByVal args() As String)
		' Create a new PdfDocument from an HTML string
		Dim Renderer = New HtmlToPdf()

		' Convert HTML string to PDF
		Dim pdf As PdfDocument = Renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>")

		' Save the PDF document to a file
		pdf.SaveAs("hello-world.pdf")

		' Output file location
		System.Console.WriteLine("PDF file created successfully at: hello-world.pdf")
	End Sub
End Class
$vbLabelText   $csharpLabel
// Example of using Spire PDF to convert HTML to PDF (might require additional setup)
using Spire.Pdf;
using Spire.Pdf.HtmlConverter; // Ensure that proper namespaces are included

class Program
{
    static void Main(string[] args)
    {
        // Initialize a PdfDocument object
        PdfDocument doc = new PdfDocument();

        // Load a web page using the HTML URL and save it as a PDF.
        // Note: Ensure that the HTML URL has complete and accessible content.
        // Be aware of potential limitations in rendering complex HTML.

        PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
        htmlLayoutFormat.IsWaiting = false;

        PdfHtmlViewPager htmlPager = new PdfHtmlViewPager();

        // Convert HTML content to PDF
        doc.LoadFromHTML("http://example.com", true, true, true, htmlLayoutFormat, htmlPager);

        // Save the document to file
        doc.SaveToFile("example.pdf");
        doc.Close();

        // Output file location
        System.Console.WriteLine("PDF file created successfully at: example.pdf");
    }
}
// Example of using Spire PDF to convert HTML to PDF (might require additional setup)
using Spire.Pdf;
using Spire.Pdf.HtmlConverter; // Ensure that proper namespaces are included

class Program
{
    static void Main(string[] args)
    {
        // Initialize a PdfDocument object
        PdfDocument doc = new PdfDocument();

        // Load a web page using the HTML URL and save it as a PDF.
        // Note: Ensure that the HTML URL has complete and accessible content.
        // Be aware of potential limitations in rendering complex HTML.

        PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
        htmlLayoutFormat.IsWaiting = false;

        PdfHtmlViewPager htmlPager = new PdfHtmlViewPager();

        // Convert HTML content to PDF
        doc.LoadFromHTML("http://example.com", true, true, true, htmlLayoutFormat, htmlPager);

        // Save the document to file
        doc.SaveToFile("example.pdf");
        doc.Close();

        // Output file location
        System.Console.WriteLine("PDF file created successfully at: example.pdf");
    }
}
' Example of using Spire PDF to convert HTML to PDF (might require additional setup)
Imports Spire.Pdf
Imports Spire.Pdf.HtmlConverter ' Ensure that proper namespaces are included

Friend Class Program
	Shared Sub Main(ByVal args() As String)
		' Initialize a PdfDocument object
		Dim doc As New PdfDocument()

		' Load a web page using the HTML URL and save it as a PDF.
		' Note: Ensure that the HTML URL has complete and accessible content.
		' Be aware of potential limitations in rendering complex HTML.

		Dim htmlLayoutFormat As New PdfHtmlLayoutFormat()
		htmlLayoutFormat.IsWaiting = False

		Dim htmlPager As New PdfHtmlViewPager()

		' Convert HTML content to PDF
		doc.LoadFromHTML("http://example.com", True, True, True, htmlLayoutFormat, htmlPager)

		' Save the document to file
		doc.SaveToFile("example.pdf")
		doc.Close()

		' Output file location
		System.Console.WriteLine("PDF file created successfully at: example.pdf")
	End Sub
End Class
$vbLabelText   $csharpLabel
Chipego
Software Engineer
Chipego has a natural skill for listening that helps him to comprehend customer issues, and offer intelligent solutions. He joined the Iron Software team in 2023, after studying a Bachelor of Science in Information Technology. IronPDF and IronOCR are the two products Chipego has been focusing on, but his knowledge of all products is growing daily, as he finds new ways to support customers. He enjoys how collaborative life is at Iron Software, with team members from across the company bringing their varied experience to contribute to effective, innovative solutions. When Chipego is away from his desk, he can often be found enjoying a good book or playing football.
< PREVIOUS
Nuget Package Installation and Project Output Example with IronPDF
NEXT >
A Comparison of IronPDF vs SelectPDF