Accusoft Prizmdoc PDF Viewer Tutorial and Comparison

Accusoft PDF Viewer provides HTML to PDF capabilities and other PDF editing and manipulation tasks for .NET. IronPDF also accomplishes these same tasks programmatically, saving you time and effort in your C# projects.

Let's compare the two and find what's best for your project.

HTML to PDF
using IronPdf;
static void Main(string[] args)
{
    //create rendering converter
    var converter = new ChromePdfRenderer();
    //render html file to pdf
    var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
    //save to target location
    PDF.SaveAs("sample.pdf");
}
Imports IronPdf
Shared Sub Main(ByVal args() As String)
	'create rendering converter
	Dim converter = New ChromePdfRenderer()
	'render html file to pdf
	Dim PDF = converter.RenderHTMLFileAsPdf("myWebPage.html")
	'save to target location
	PDF.SaveAs("sample.pdf")
End Sub
Jump to Article
Image to PDF
using IronPdf;
static void Main(string[] args)
{
    //specify the image to be convert
    var converter = ImageToPdfConverter.ImageToPdf("google.png");
    //save PDF file to the target location
    converter.SaveAs("sample.pdf");
}
Imports IronPdf
Shared Sub Main(ByVal args() As String)
	'specify the image to be convert
	Dim converter = ImageToPdfConverter.ImageToPdf("google.png")
	'save PDF file to the target location
	converter.SaveAs("sample.pdf")
End Sub
Jump to Article
Merge PDF Files
using IronPdf;
using System.Collections.Generic;
static void Main(string[] args)
{
    //create rendering converter  
    var Renderer = new IronPdf.ChromePdfRenderer();
    //create a list of pdf files
    var PDFs = new List<PdfDocument>();
    PDFs.Add(PdfDocument.FromFile("A.pdf"));
    PDFs.Add(PdfDocument.FromFile("B.pdf"));
    PDFs.Add(PdfDocument.FromFile("C.pdf"));
    //merge the list of pdf file
    PdfDocument PDF = PdfDocument.Merge(PDFs);
    //save merged file to the target location
    PDF.SaveAs("sample.pdf");
}
Imports IronPdf
Imports System.Collections.Generic
Shared Sub Main(ByVal args() As String)
	'create rendering converter  
	Dim Renderer = New IronPdf.ChromePdfRenderer()
	'create a list of pdf files
	Dim PDFs = New List(Of PdfDocument)()
	PDFs.Add(PdfDocument.FromFile("A.pdf"))
	PDFs.Add(PdfDocument.FromFile("B.pdf"))
	PDFs.Add(PdfDocument.FromFile("C.pdf"))
	'merge the list of pdf file
	Dim PDF As PdfDocument = PdfDocument.Merge(PDFs)
	'save merged file to the target location
	PDF.SaveAs("sample.pdf")
End Sub
Jump to Article
PDF to Image
using IronPdf;
static void Main(string[] args)
{
    //specify file to be converted
    var pdf = PdfDocument.FromFile("Sample_PDF.pdf");
    //save images to the target location
    pdf.RasterizeToImageFiles("image_*.png");
}
Imports IronPdf
Shared Sub Main(ByVal args() As String)
	'specify file to be converted
	Dim pdf = PdfDocument.FromFile("Sample_PDF.pdf")
	'save images to the target location
	pdf.RasterizeToImageFiles("image_*.png")
End Sub
Jump to Article
Try IronPDF free for development

Overview

About IronPDF

IronPDF is a C# HTML to PDF library. It enables engineers to do tasks including creating PDF files from sources like HTML string, WebPage, URL, as well as setting the properties like Watermark, Bookmark, Header and Footer etc. We also can merge multiple PDF files into one, or PDF pages to images, or vice versa.

It is free for development, and offers a 30-day deployment trial to go live with your project.

About Accusoft PrizmDoc Viewer

PrizmDoc Viewer is a REST API that is used to work with PDF files and convert them into other formats remotely. PrizmDoc can convert 100+ different formats of the file to PDF and PDF to PNG, JPG, TIFF, and SVG. It also can be used to include different types of electronic signature options in the applications.

Comparison Table

IronPDFPrizmDoc Viewer
Work with PDF files programmatically.Work with PDF files programmatically.
Supports .NET core with Window, Mac, or Linux.Supports .NET Core using Window, Mac, or Linux.
Works LocallySends Documents to a remote server.
Work with or without using Asynchronous Programming.Must use Asynchronous Programming using `System.Threading.Tasks`.
Easily work offline once we install IronPF in our system.Must connect with the internet to send the request to the PrizmDoc Viewer server (Cloud-hosted or self-hosted).
Provides many predefined functions.Provides some predefined functions.
Often requires minimal lines of code.Often requires many lines of code.
Unlimited conversions per project in each license plan.Limited number of transactions in each cloud-hosted license plan.
Free for development with no time limit.Only 300 transactions with trial.

Let's install the two and compare the code.


Step 1: Installation

1. Install the IronPDF Library

There are two ways to install IronPDF in your project, with no difference which one you adopt.

1.1. Download the IronPDF DLL

Download IronPDF.dll and add its reference to your project. After this, you can easily access the namespace IronPdf by the following way:

using IronPdf;

Now, you can easily access the provided functions and classes of IronPDF.

1.2 Install via NuGet Package Manager

  • Package Manager Console:

    If you are using the Package Manager Console then run the following command:

    PM > Install-Package IronPDF

  • Manage Packages for Solution:

    If you are using the GUI of NuGet Package Manager, then browse IronPDF in the search bar and install it.


Install the PrizmDoc Viewer from Accusoft

There are two parts of PrizmDoc Viewer, one is the server-side called PrizmDoc Server which behaves as a Restful API. The other is our project, by which we hit that API and get the response.

Access the PrizmDoc Server

As we see from its name, it is a server-side application that gets the basic information with the document as a request (input) and converts the document to a PDF file, then sends the converted PDF file to the client as a response (output). It is the technical heart of the product, which is a document processing and conversion engine. We can use it via two different ways, with no difference which you adopt because both have the same programming structure and techniques:

  1. Self-Hosted:

    For this option, you need to arrange your server and you can Download PrizmDoc Server then install it.Read More about how to install PrizmDoc Server on windows.

    Note: It needs a minimum 32GB Ram and 4 Core CPU, otherwise, you can face a bad experience.

  2. Cloud-Hosted:

    It is a cloud-based service of PrizmDoc Viewer and you do not need to arrange your server. We will use it for our comparison. To do this, create your account and then the homepage will open. You can copy API key from the API Key menu, we will see later how to use it.

First, we will see the basic structure for how to work with PrizmDoc Viewer to convert the documents into a PDF file, and we will directly interact with Accusoft server using WebClient() in C# Console Application.

Note: The following example is only for a conceptual understanding of how PrizmDoc handles PDF files. It is a bit long, so no problem if you skip this example and move on to the comparison directly.

Accusoft Working Structure

In this example, we will convert the myWebpage.html to the sample.pdf file.

Note: We have to install the Newtonsoft library and add its reference in the project.

First, add the following libraries to your project:

using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;//install Newtonsoft
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;//install Newtonsoft
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Threading.Tasks
Imports Newtonsoft.Json.Linq 'install Newtonsoft
VB   C#

Then create a public variable Accusoft API Key and paste your API Key in it as follows:

static string ApiKey= "Your-API-KEY";

There are 3 steps to deal with PDF file using PrizmDoc Viewer:

  1. Upload a file to the PrizmDoc server.
  2. Convert the uploaded file.
  3. Download converted file from PrizmDoc server.

So, we will make a separate function for each step.

static void Main(string[] args)
{
    //---Upload file to Server---
    JObject uploadResults = UploadToServer("myWebpage.html").Result;
    string fileID = (string)uploadResults.SelectToken("fileId");
    string affinityToken = (string)uploadResults.SelectToken("affinityToken");

    //---Convert the uploaded file to PDF---
    JObject convertResults = Convert(affinityToken, fileID).Result;
    string processId = (string)convertResults.SelectToken("processId");
    affinityToken = (string)convertResults.SelectToken("affinityToken");

    //---Check the status that conversion is completed---
    JObject convertStatusresults = ConvertStatus(processId, affinityToken).Result;
    string convertStatus = (string)convertResults.SelectToken("state");

    //---Continuously checking whether conversion completed or not until completed---
    while (!(convertStatus.Equals("complete")))
    {
        System.Threading.Thread.Sleep(30000);
        convertStatusresults = ConvertStatus(processId, affinityToken).Result;
        convertStatus = (string)convertStatusresults.SelectToken("state");
    }

    //---Download the converted file from server---
    string newFileID = (string)convertStatusresults.SelectToken("output.results[0].fileId");
    DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait();

    Console.WriteLine("PDF file created successfully...!");
    Console.ReadKey();
}
static void Main(string[] args)
{
    //---Upload file to Server---
    JObject uploadResults = UploadToServer("myWebpage.html").Result;
    string fileID = (string)uploadResults.SelectToken("fileId");
    string affinityToken = (string)uploadResults.SelectToken("affinityToken");

    //---Convert the uploaded file to PDF---
    JObject convertResults = Convert(affinityToken, fileID).Result;
    string processId = (string)convertResults.SelectToken("processId");
    affinityToken = (string)convertResults.SelectToken("affinityToken");

    //---Check the status that conversion is completed---
    JObject convertStatusresults = ConvertStatus(processId, affinityToken).Result;
    string convertStatus = (string)convertResults.SelectToken("state");

    //---Continuously checking whether conversion completed or not until completed---
    while (!(convertStatus.Equals("complete")))
    {
        System.Threading.Thread.Sleep(30000);
        convertStatusresults = ConvertStatus(processId, affinityToken).Result;
        convertStatus = (string)convertStatusresults.SelectToken("state");
    }

    //---Download the converted file from server---
    string newFileID = (string)convertStatusresults.SelectToken("output.results[0].fileId");
    DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait();

    Console.WriteLine("PDF file created successfully...!");
    Console.ReadKey();
}
Shared Sub Main(ByVal args() As String)
	'---Upload file to Server---
	Dim uploadResults As JObject = UploadToServer("myWebpage.html").Result
	Dim fileID As String = CStr(uploadResults.SelectToken("fileId"))
	Dim affinityToken As String = CStr(uploadResults.SelectToken("affinityToken"))

	'---Convert the uploaded file to PDF---
	Dim convertResults As JObject = Convert(affinityToken, fileID).Result
	Dim processId As String = CStr(convertResults.SelectToken("processId"))
	affinityToken = CStr(convertResults.SelectToken("affinityToken"))

	'---Check the status that conversion is completed---
	Dim convertStatusresults As JObject = ConvertStatus(processId, affinityToken).Result
	Dim convertStatus As String = CStr(convertResults.SelectToken("state"))

	'---Continuously checking whether conversion completed or not until completed---
	Do While Not (convertStatus.Equals("complete"))
		System.Threading.Thread.Sleep(30000)
		convertStatusresults = ConvertStatus(processId, affinityToken).Result
		convertStatus = CStr(convertStatusresults.SelectToken("state"))
	Loop

	'---Download the converted file from server---
	Dim newFileID As String = CStr(convertStatusresults.SelectToken("output.results[0].fileId"))
	DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait()

	Console.WriteLine("PDF file created successfully...!")
	Console.ReadKey()
End Sub
VB   C#

1. Upload file to the Server:

public static async Task<JObject> UploadToServer(string fileToUpload)
{
    FileInfo input = new FileInfo(fileToUpload);
    if (input == null)
    {
        throw new ArgumentException("Missing parameter input", "input");
    }
    var fileName = input.Name;
    var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile");
    using (var client = new WebClient())
    {
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Content-Type", "application/octet-stream");
        using (var reader = new BinaryReader(input.OpenRead()))
        {
            var data = reader.ReadBytes((int)reader.BaseStream.Length);
            var results = await client.UploadDataTaskAsync(endpoint, "POST", data);
            string getResult = "";
            getResult = Encoding.ASCII.GetString(results);
            return JObject.Parse(getResult);
        }
    }
}
public static async Task<JObject> UploadToServer(string fileToUpload)
{
    FileInfo input = new FileInfo(fileToUpload);
    if (input == null)
    {
        throw new ArgumentException("Missing parameter input", "input");
    }
    var fileName = input.Name;
    var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile");
    using (var client = new WebClient())
    {
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Content-Type", "application/octet-stream");
        using (var reader = new BinaryReader(input.OpenRead()))
        {
            var data = reader.ReadBytes((int)reader.BaseStream.Length);
            var results = await client.UploadDataTaskAsync(endpoint, "POST", data);
            string getResult = "";
            getResult = Encoding.ASCII.GetString(results);
            return JObject.Parse(getResult);
        }
    }
}
Public Shared Async Function UploadToServer(ByVal fileToUpload As String) As Task(Of JObject)
	Dim input As New FileInfo(fileToUpload)
	If input Is Nothing Then
		Throw New ArgumentException("Missing parameter input", "input")
	End If
	Dim fileName = input.Name
	Dim endpoint = New Uri("https://api.accusoft.com/PCCIS/V1/WorkFile")
	Using client = New WebClient()
		client.Headers.Add("acs-api-key", ApiKey)
		client.Headers.Add("Content-Type", "application/octet-stream")
		Using reader = New BinaryReader(input.OpenRead())
			Dim data = reader.ReadBytes(CInt(reader.BaseStream.Length))
			Dim results = Await client.UploadDataTaskAsync(endpoint, "POST", data)
			Dim getResult As String = ""
			getResult = Encoding.ASCII.GetString(results)
			Return JObject.Parse(getResult)
		End Using
	End Using
End Function
VB   C#

2. Convert the uploaded file to PDF:

public static async Task<JObject> Convert(string affinityToken, string fileID)
{
    var endpoint = new Uri("https://api.accusoft.com/v2/contentConverters");
    using (var client = new WebClient())
    {
        client.Headers.Add("Content-Type", "application/json");
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
        JObject myJson =
            new JObject(
                new JProperty("input",
                    new JObject(
                        new JProperty("sources",
                            new JArray(
                                new JObject(
                                    new JProperty("fileId", fileID)
                                    )
                                )
                            ),
                            new JProperty("dest",
                                new JObject(
                                    new JProperty("format", "pdf")
                                )
                            )
                        )
                    )
                );
            string results = await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString());
            return JObject.Parse(results);
    }
}
public static async Task<JObject> Convert(string affinityToken, string fileID)
{
    var endpoint = new Uri("https://api.accusoft.com/v2/contentConverters");
    using (var client = new WebClient())
    {
        client.Headers.Add("Content-Type", "application/json");
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
        JObject myJson =
            new JObject(
                new JProperty("input",
                    new JObject(
                        new JProperty("sources",
                            new JArray(
                                new JObject(
                                    new JProperty("fileId", fileID)
                                    )
                                )
                            ),
                            new JProperty("dest",
                                new JObject(
                                    new JProperty("format", "pdf")
                                )
                            )
                        )
                    )
                );
            string results = await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString());
            return JObject.Parse(results);
    }
}
Public Shared Async Function Convert(ByVal affinityToken As String, ByVal fileID As String) As Task(Of JObject)
	Dim endpoint = New Uri("https://api.accusoft.com/v2/contentConverters")
	Using client = New WebClient()
		client.Headers.Add("Content-Type", "application/json")
		client.Headers.Add("acs-api-key", ApiKey)
		client.Headers.Add("Accusoft-Affinity-Token", affinityToken)
		Dim myJson As New JObject(New JProperty("input", New JObject(New JProperty("sources", New JArray(New JObject(New JProperty("fileId", fileID)))), New JProperty("dest", New JObject(New JProperty("format", "pdf"))))))
			Dim results As String = Await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString())
			Return JObject.Parse(results)
	End Using
End Function
VB   C#

The following JSON is the resulting value of the myJson object:

{
  "input": {
    "sources": 
    [
      {"fileId": "Auto Generated FileId Value"}
    ],
    "dest": {
      "format": "pdf"
    }
  }
}

Check the status whether the conversion is completed or not

public static async Task<JObject> ConvertStatus(string processId, string affinityToken)
{
    string endpoint = "https://api.accusoft.com/v2/contentConverters/" + processId;
    using (var client = new WebClient())
    {
        client.BaseAddress = endpoint;
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
        string results = await client.DownloadStringTaskAsync(endpoint);
        return JObject.Parse(results);
    }
}
public static async Task<JObject> ConvertStatus(string processId, string affinityToken)
{
    string endpoint = "https://api.accusoft.com/v2/contentConverters/" + processId;
    using (var client = new WebClient())
    {
        client.BaseAddress = endpoint;
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
        string results = await client.DownloadStringTaskAsync(endpoint);
        return JObject.Parse(results);
    }
}
Public Shared Async Function ConvertStatus(ByVal processId As String, ByVal affinityToken As String) As Task(Of JObject)
	Dim endpoint As String = "https://api.accusoft.com/v2/contentConverters/" & processId
	Using client = New WebClient()
		client.BaseAddress = endpoint
		client.Headers.Add("acs-api-key", ApiKey)
		client.Headers.Add("Accusoft-Affinity-Token", affinityToken)
		Dim results As String = Await client.DownloadStringTaskAsync(endpoint)
		Return JObject.Parse(results)
	End Using
End Function
VB   C#

3. Download the converted file from server

public static async Task DownloadFromServer(string affinityToken, string fileId, string outfile)
{
    var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" + fileId);

    using (var client = new WebClient())
    {
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
        FileInfo output = new FileInfo(outfile);

        using (var writeStream = output.Create())
        {
            var results = await client.DownloadDataTaskAsync(endpoint);
            await writeStream.WriteAsync(results, 0, results.Length);
        }
    }
}
public static async Task DownloadFromServer(string affinityToken, string fileId, string outfile)
{
    var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" + fileId);

    using (var client = new WebClient())
    {
        client.Headers.Add("acs-api-key", ApiKey);
        client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
        FileInfo output = new FileInfo(outfile);

        using (var writeStream = output.Create())
        {
            var results = await client.DownloadDataTaskAsync(endpoint);
            await writeStream.WriteAsync(results, 0, results.Length);
        }
    }
}
Public Shared Async Function DownloadFromServer(ByVal affinityToken As String, ByVal fileId As String, ByVal outfile As String) As Task
	Dim endpoint = New Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" & fileId)

	Using client = New WebClient()
		client.Headers.Add("acs-api-key", ApiKey)
		client.Headers.Add("Accusoft-Affinity-Token", affinityToken)
		Dim output As New FileInfo(outfile)

		Using writeStream = output.Create()
			Dim results = Await client.DownloadDataTaskAsync(endpoint)
			Await writeStream.WriteAsync(results, 0, results.Length)
		End Using
	End Using
End Function
VB   C#

The above example requires a lot of effort! To minimize the workload, Accusoft introduced a .NET library named Accusoft.PrizmDocServerSDK, it is a wrapper around the PrizmDoc Server REST API. Let's see how to install and use this library in our .NET project

Install the Accusoft.PrizmDocServerSDK

There are two ways to install the wrapper.

  • Package Manager Console:

    If you are using the Package manager console then run the following command: PM> install-package Accusoft.PrizmDocServerSDK

  • Manage Packages for Solution:

    If you are using the GUI of NuGet Package Manager then browse Accusoft.PrizmDocServerSDK in the search bar and install it.

Now, you can easily access the Accusoft.PrizmDocServer namespace and use it by accessing:

using Accusoft.PrizmDocServer;


How To Tutorials

2. IronPDF vs PrizmDoc Viewer Code Comparison

After reading the introduction and installation of both components, now it is the time to work with both components. For this, we will take some use cases and implement them using both components. We hope this provides a way to easily understand both programming structures and conclude which one is the best for your project.


3. Convert HTML to PDF File

In our first comparison, let's take the use case that we have a web page named myWebPage.html and want to create a PDF file from it, then save it to the target location.

3.1. IronPDF HTML to PDF

using IronPdf;
static void Main(string[] args)
{
    //create rendering converter
    var converter = new ChromePdfRenderer();
    //render html file to pdf
    var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
    //save to target location
    PDF.SaveAs("sample.pdf");
}
using IronPdf;
static void Main(string[] args)
{
    //create rendering converter
    var converter = new ChromePdfRenderer();
    //render html file to pdf
    var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
    //save to target location
    PDF.SaveAs("sample.pdf");
}
Imports IronPdf
Shared Sub Main(ByVal args() As String)
	'create rendering converter
	Dim converter = New ChromePdfRenderer()
	'render html file to pdf
	Dim PDF = converter.RenderHTMLFileAsPdf("myWebPage.html")
	'save to target location
	PDF.SaveAs("sample.pdf")
End Sub
VB   C#

The above code will create a sample.pdf file and save to the bin>debug folder of the project.

You also can specify any path like this: PDF.SaveAs("E:/sample.pdf");

Read More about how to work with IronPDF to deal with PDF files.

Now, we will do the same task using the PrizmDoc Viewer, so that our comparison becomes easy.

3.2. PrizmDoc Viewer HTML to PDF

In the PrizmDoc Viewer installation, we already discussed how to get the Accusoft API Key, and now we will see how to use it.

First we send a request to the PrizmDoc server and get a response from it. This process will take some time, so we need to use Asynchronous Programming.

Note: Make sure that your system is connected to the internet while creating PDF files using Cloud services of PrizmDoc Viewer.

using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string[] args)
{
    ChromePdfRenderer().GetAwaiter().GetResult();
}
private static async Task ChromePdfRenderer()
{
    //instantiate PrizmDocServerClient object
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    // specify HTML file and convert it to a PDF.
    ConversionResult result = await prizmDocServer.ConvertToPdfAsync("myWebPage.html");
    // Save pdf file to the target location
    await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string[] args)
{
    ChromePdfRenderer().GetAwaiter().GetResult();
}
private static async Task ChromePdfRenderer()
{
    //instantiate PrizmDocServerClient object
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    // specify HTML file and convert it to a PDF.
    ConversionResult result = await prizmDocServer.ConvertToPdfAsync("myWebPage.html");
    // Save pdf file to the target location
    await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
Imports Accusoft.PrizmDocServer
Imports Accusoft.PrizmDocServer.Conversion
Shared Sub Main(ByVal args() As String)
	ChromePdfRenderer().GetAwaiter().GetResult()
End Sub
Private Shared Async Function ChromePdfRenderer() As Task
	'instantiate PrizmDocServerClient object
	Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
	' specify HTML file and convert it to a PDF.
	Dim result As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("myWebPage.html")
	' Save pdf file to the target location
	Await result.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
VB   C#

Read more about how to work with PrizmDoc Viewer.

3.3. HTML to PDF Code Comparison

We see from these examples that IronPDF is a simpler approach to creating PDF files and does not require as much time. You can


4. Image to PDF

In this comparison, we take a use case that we need to create a PDF file by the Image and it exists in our the debug folder of the project. Let's start with IronPDF.

4.1. IronPDF Image to PDF

using IronPdf;
static void Main(string[] args)
{
    //specify the image to be convert
    var converter = ImageToPdfConverter.ImageToPdf("google.png");
    //save PDF file to the target location
    converter.SaveAs("sample.pdf");
}
using IronPdf;
static void Main(string[] args)
{
    //specify the image to be convert
    var converter = ImageToPdfConverter.ImageToPdf("google.png");
    //save PDF file to the target location
    converter.SaveAs("sample.pdf");
}
Imports IronPdf
Shared Sub Main(ByVal args() As String)
	'specify the image to be convert
	Dim converter = ImageToPdfConverter.ImageToPdf("google.png")
	'save PDF file to the target location
	converter.SaveAs("sample.pdf")
End Sub
VB   C#

Output:

This screenshot is of a newly created PDF file sample.pdf using the above code:

We can see how easy it is to create a PDF file from an image image using IronPDF. Now, we will do the same task using PrizmDoc Viewer and see its generated PDF file.

4.2. PrizmDoc Viewer Image to PDF

static void Main(string[] args)
{
    ImageToPDF().GetAwaiter().GetResult();
}
private static async Task ImageToPDF()
{
    //instantiate PrizmDocServerClient object
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    //specify the image to be convert
    ConversionResult results = await prizmDocServer.ConvertToPdfAsync("google.png");
    //save pdf file to the target location
    await results.RemoteWorkFile.SaveAsync("sample.pdf");
}
static void Main(string[] args)
{
    ImageToPDF().GetAwaiter().GetResult();
}
private static async Task ImageToPDF()
{
    //instantiate PrizmDocServerClient object
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    //specify the image to be convert
    ConversionResult results = await prizmDocServer.ConvertToPdfAsync("google.png");
    //save pdf file to the target location
    await results.RemoteWorkFile.SaveAsync("sample.pdf");
}
Shared Sub Main(ByVal args() As String)
	ImageToPDF().GetAwaiter().GetResult()
End Sub
Private Shared Async Function ImageToPDF() As Task
	'instantiate PrizmDocServerClient object
	Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
	'specify the image to be convert
	Dim results As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("google.png")
	'save pdf file to the target location
	Await results.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
VB   C#

Output: This screenshot is of a newly created PDF file sample.pdf from the above code:

4.3. Image to PDF Code Comparison

We can see that we just need to write 2 simple lines of code using IronPDF. On the other hand, using the PrizmDoc server, we have to write many lines of code with Asynchronous Programming. Thge output of IronPDF also automatically provides a usable full-page document.


5. Merge PDF Files

In this comparison, let's suppose that we have three PDF files named A.pdf, B.pdf, and C.pdf. We want to merge them into one PDF file, and we can do this task using both components. First, we will see how to perform this task using IronPDF.

5.1. IronPDF Merge PDF Files

using IronPdf;
using System.Collections.Generic;
static void Main(string[] args)
{
    //create rendering converter  
    var Renderer = new IronPdf.ChromePdfRenderer();
    //create a list of pdf files
    var PDFs = new List<PdfDocument>();
    PDFs.Add(PdfDocument.FromFile("A.pdf"));
    PDFs.Add(PdfDocument.FromFile("B.pdf"));
    PDFs.Add(PdfDocument.FromFile("C.pdf"));
    //merge the list of pdf file
    PdfDocument PDF = PdfDocument.Merge(PDFs);
    //save merged file to the target location
    PDF.SaveAs("sample.pdf");
}
using IronPdf;
using System.Collections.Generic;
static void Main(string[] args)
{
    //create rendering converter  
    var Renderer = new IronPdf.ChromePdfRenderer();
    //create a list of pdf files
    var PDFs = new List<PdfDocument>();
    PDFs.Add(PdfDocument.FromFile("A.pdf"));
    PDFs.Add(PdfDocument.FromFile("B.pdf"));
    PDFs.Add(PdfDocument.FromFile("C.pdf"));
    //merge the list of pdf file
    PdfDocument PDF = PdfDocument.Merge(PDFs);
    //save merged file to the target location
    PDF.SaveAs("sample.pdf");
}
Imports IronPdf
Imports System.Collections.Generic
Shared Sub Main(ByVal args() As String)
	'create rendering converter  
	Dim Renderer = New IronPdf.ChromePdfRenderer()
	'create a list of pdf files
	Dim PDFs = New List(Of PdfDocument)()
	PDFs.Add(PdfDocument.FromFile("A.pdf"))
	PDFs.Add(PdfDocument.FromFile("B.pdf"))
	PDFs.Add(PdfDocument.FromFile("C.pdf"))
	'merge the list of pdf file
	Dim PDF As PdfDocument = PdfDocument.Merge(PDFs)
	'save merged file to the target location
	PDF.SaveAs("sample.pdf")
End Sub
VB   C#

The above code will create a sample.pdf file, which is the combination of A.pdf, B.pdf, and C.pdf.

Now, we will do the same task using PrizmDoc Viewer.

5.2. PrizmDoc Viewer Merge PDF Files

using System.Threading.Tasks;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;

static void Main(string[] args)
{
    PdfMerge().GetAwaiter().GetResult();
}
private static async Task PdfMerge()
{
    //instantiate PrizmDocServerClient object
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    //pass the list of pdf files to PrizmDoc Server
    ConversionResult result = await prizmDocServer.CombineToPdfAsync(
        new[]{
                new ConversionSourceDocument("A.pdf"),
                new ConversionSourceDocument("B.pdf"),
                new ConversionSourceDocument("C.pdf"),
            });
    //save merged file to the target location
    await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
using System.Threading.Tasks;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;

static void Main(string[] args)
{
    PdfMerge().GetAwaiter().GetResult();
}
private static async Task PdfMerge()
{
    //instantiate PrizmDocServerClient object
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    //pass the list of pdf files to PrizmDoc Server
    ConversionResult result = await prizmDocServer.CombineToPdfAsync(
        new[]{
                new ConversionSourceDocument("A.pdf"),
                new ConversionSourceDocument("B.pdf"),
                new ConversionSourceDocument("C.pdf"),
            });
    //save merged file to the target location
    await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
Imports System.Threading.Tasks
Imports Accusoft.PrizmDocServer
Imports Accusoft.PrizmDocServer.Conversion

Shared Sub Main(ByVal args() As String)
	PdfMerge().GetAwaiter().GetResult()
End Sub
Private Shared Async Function PdfMerge() As Task
	'instantiate PrizmDocServerClient object
	Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
	'pass the list of pdf files to PrizmDoc Server
	Dim result As ConversionResult = Await prizmDocServer.CombineToPdfAsync({
		New ConversionSourceDocument("A.pdf"),
		New ConversionSourceDocument("B.pdf"),
		New ConversionSourceDocument("C.pdf")
	})
	'save merged file to the target location
	Await result.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
VB   C#

The above code will also create a sample.pdf file, which is the combination of A.pdf, B.pdf, and C.pdf files.


In this comparison, let's suppose that we have a simple WebPage named myWebPage.html which has the following HTML and CSS:

<html>
<head>
    <style>
        li {
            font-size:x-large;
            color: rgba(156, 89, 13, 0.897);
            list-style:square;
        }
  </style>
</head>
<body>
    <h1 style="text-align: center;">Hello World..!</h1>
    <h1>Main Menu</h1>
    <ul>
        <li>SubMenu 1</li>
        <li>SubMenu 2</li>
        <li>SubMenu 3</li>
        <li>SubMenu 4</li>
        <li>SubMenu 5</li>
    </ul>
</body>
</html>
HTML

We want to convert this WebPage to a PDF file, setting the following Header and Footer properties:

  • Page Title on the left side of the Header,
  • DateTime on the right side of the Header
  • Page Number of Total Pages on the right side of the Footer.

First, we will look at how to work with IronPDF to set the Header and Footer.

To deal with the Header and Footer of a PDF file, IronPDF provides a class named PrintOptions which can be used as follow:

  • For Header: C# ChromePdfRenderer_Obj.RenderingOptions.TextHeader=new TextHeaderFooter()

  • For Footer: C# ChromePdfRenderer_Obj.RenderingOptions.TextFooter=new TextHeaderFooter()

We can set the following properties while initializing TextHeaderFooter():

  • CenterText to print the text in the center of the Header or Footer.
  • LeftText to print the text on the left side of the Header or Footer.
  • RightText to print the text on the right side of the Header or Footer.
  • DrawDividerLine it draw a line which separates the page content from the Header or Footer.
  • FontFamily to specify the font family of Header or Footer.
  • FontSize to specify the font size of the Header or Footer.
  • Spacing it adjusts the space between page content and Header or Footer.

Some following predefined attributes are very helpful to set Header or Footer content. It can be write in Curly brackets { } as follows:

  • {page} it prints the current page number in the Header or Footer.
  • {total-pages} it prints the total number of pages in the Header or Footer.
  • {url} it used to print the URL of the rendered page.
  • {date} it prints the current date in the Header or Footer.
  • {time} it prints the current time in the Header or Footer.
  • {html-title} it prints the title of the rendered web page in the Header or Footer
  • {pdf-title} it prints the document title in the Header or Footer.

Read More in detail on how to work with Header and Footer using IronPDF.

Let's see the following example to implement the use case and demonstrate how to use the above properties to set the Header and Footer of a PDF file.

using IronPdf;
static void Main(string[] args)
{
    //create rendering converter
    var converter = new ChromePdfRenderer();
    //setting Header properties
    converter.RenderingOptions.TextHeader = new TextHeaderFooter()
    {
        DrawDividerLine = true,
        LeftText = "Page Title",
        RightText = "{date} {time}",
        FontSize = 13
    };
    //setting footer properties
    converter.RenderingOptions.TextFooter = new TextHeaderFooter()
    {
        RightText = "Page {page} of {total-pages}",
        FontSize = 12
    };
    //specify the file to be converted
    var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
    //save to target location
    PDF.SaveAs("sample.pdf");
}
using IronPdf;
static void Main(string[] args)
{
    //create rendering converter
    var converter = new ChromePdfRenderer();
    //setting Header properties
    converter.RenderingOptions.TextHeader = new TextHeaderFooter()
    {
        DrawDividerLine = true,
        LeftText = "Page Title",
        RightText = "{date} {time}",
        FontSize = 13
    };
    //setting footer properties
    converter.RenderingOptions.TextFooter = new TextHeaderFooter()
    {
        RightText = "Page {page} of {total-pages}",
        FontSize = 12
    };
    //specify the file to be converted
    var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
    //save to target location
    PDF.SaveAs("sample.pdf");
}
Imports IronPdf
Shared Sub Main(ByVal args() As String)
	'create rendering converter
	Dim converter = New ChromePdfRenderer()
	'setting Header properties
	converter.RenderingOptions.TextHeader = New TextHeaderFooter() With {
		.DrawDividerLine = True,
		.LeftText = "Page Title",
		.RightText = "{date} {time}",
		.FontSize = 13
	}
	'setting footer properties
	converter.RenderingOptions.TextFooter = New TextHeaderFooter() With {
		.RightText = "Page {page} of {total-pages}",
		.FontSize = 12
	}
	'specify the file to be converted
	Dim PDF = converter.RenderHTMLFileAsPdf("myWebPage.html")
	'save to target location
	PDF.SaveAs("sample.pdf")
End Sub
VB   C#

Output: The screenshot of the newly created PDF file sample.pdf by the above code:

We can see how simple it is to work with the Header and Footer using intuitive language while creating a PDF file using IronPDF. Now, we will see how to use PrizmDoc Viewer to set Header and Footer.

PrizmDoc Viewer provides the HeaderFooterOptions class to deal with Header and Footer, with the following properties:

  • Lines it specifies the line(s) for Header and Footer(more clear when you understand the following example), each line has the following properties:
    • Left prints the text on the left side of the Header or Footer line.
    • Center prints the text on the left side of the Header or Footer line.
    • Right prints the text on the right side of the Header or Footer line.
  • FontFamily to specify the font family of the Header or Footer text.
  • FontSize to specify the font size of the Header or Footer text.
  • Color to specify the color of the Header or Footer text.

Read More about how to set Header and Footer of a PDF page using PrizmDoc server.

Let's see how to implement our use case using the above properties.

using System.Threading.Tasks;
using System.Collections.Generic;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string[] args)
{
    SetHeaderFooter().GetAwaiter().GetResult();
}
private static async Task SetHeaderFooter()
{
    //instantiate PrizmDocServerClient object with Header and footer properties
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    ConversionResult result = await prizmDocServer.ConvertToPdfAsync(
    "myWebPage.html",
    header: new HeaderFooterOptions
        {
            Lines = new List<HeaderFooterLine>
            {
                new HeaderFooterLine { Left = "Page Title", Right = DateTime.Now.ToString() }
            },
        },
    footer: new HeaderFooterOptions
    {
        Lines = new List<HeaderFooterLine>
        {
            new HeaderFooterLine { Right = "Page {{pageNumber}} of {{pageCount}}" },
        },
    });
    //save to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
using System.Threading.Tasks;
using System.Collections.Generic;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string[] args)
{
    SetHeaderFooter().GetAwaiter().GetResult();
}
private static async Task SetHeaderFooter()
{
    //instantiate PrizmDocServerClient object with Header and footer properties
    var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
    ConversionResult result = await prizmDocServer.ConvertToPdfAsync(
    "myWebPage.html",
    header: new HeaderFooterOptions
        {
            Lines = new List<HeaderFooterLine>
            {
                new HeaderFooterLine { Left = "Page Title", Right = DateTime.Now.ToString() }
            },
        },
    footer: new HeaderFooterOptions
    {
        Lines = new List<HeaderFooterLine>
        {
            new HeaderFooterLine { Right = "Page {{pageNumber}} of {{pageCount}}" },
        },
    });
    //save to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
Imports System.Threading.Tasks
Imports System.Collections.Generic
Imports Accusoft.PrizmDocServer
Imports Accusoft.PrizmDocServer.Conversion
Shared Sub Main(ByVal args() As String)
	SetHeaderFooter().GetAwaiter().GetResult()
End Sub
Private Shared Async Function SetHeaderFooter() As Task
	'instantiate PrizmDocServerClient object with Header and footer properties
	Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
	Dim result As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("myWebPage.html", header:= New HeaderFooterOptions With {.Lines = New List(Of HeaderFooterLine) _
		From {
			New HeaderFooterLine With {
				.Left = "Page Title",
				.Right = DateTime.Now.ToString()
			}
		}
		},
		footer:= New HeaderFooterOptions With {
		.Lines = New List(Of HeaderFooterLine) From {
			New HeaderFooterLine With {.Right = "Page {{pageNumber}} of {{pageCount}}"}
		}
		})
	'save to the target location
Await result.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
VB   C#

Output:

The screenshot of the newly created PDF file by above code:

We can see that IronPDF provides more functions to set Header and Footer properties with a simple programming structure as compared to PrizmDoc Viewer. It is also suggsted that the PDF file generated by IronPDF is more readable and attractive than the PrizmDoc Viewer generated file.


7. Convert PDF Pages to Images

Let's take one more use case: we have a simple PDF file named Sample_PDF.pdf which has just 2 pages.

Page1Page2