Syncfusion PDF Viewer Comparison for HTML to PDF

Developers need simple, easy-to-read functions and short lines of code to work with PDF documents in C# projects. Handling PDFs, including generating, editing, deleting, manipulating, and customizing document outputs in .NET, can be done efficiently with the right library.

Syncfusion

Syncfusion is a software development company that provides different components (3rd party tools) for developers to work with PDF, Excel files, and any other format. Today we'll look specifically at their Syncfusion PDF Viewer, used to work with PDF files, and the HTML to PDF Converter to handle generating PDF documents from an HTML source.

IronPDF C# PDF Library

IronPDF is a component by IronSoftware for .NET developers. It provides a simple and intelligent method to convert any type of HTML page into PDF format, easily generating any type of PDF file with just a few lines of code. IronPDF is very popular among its customers. Its high performance helps render large amounts of data quickly. It has a rich feature set. In addition, it provides features to add any type of data to the PDF page programmatically, including headers, footers, watermarks, or bookmarks. You can download its latest version from the IronPDF website. You can access its website from any browser.

Comparing IronPDF vs. Syncfusion

As developers, we try our best to choose components that provide the best way to achieve our target in as few lines of efficient and successful code as possible. To compare working with PDFs, we'll look at the two products, how they deal with PDF files, and compare the functionalities for you to decide what's best for your project.

1. IronPDF Free C# HTML to PDF Library

We'll be looking at some different methods and project use cases for HTML to PDF, which you can follow along by downloading the IronPDF C# HTML to PDF library, always free for development.

1.1 Install IronPDF via NuGet Packager

Using NuGet Package Manager in your Visual Studio project, you can browse for IronPDF and install it.

Install-Package IronPdf

1.2 Download IronPdf.dll

Alternatively, you can download IronPDF.dll and add its reference to your project.

IronPDF classes can be accessed using the IronPdf namespace.

1.3. IronPDF Platform Support

.NET framework 4.0 or above on

  • Windows
  • Azure

.NET Standard 2.0 & Core 2 & 3 on

  • Windows
  • macOS
  • Linux
  • Azure

Cloud hosting services included

  • Microsoft Azure
  • Docker
  • AWS

Can be used with

  • ASP.NET MVC Application
  • ASP.NET Web Forms Application
  • Console Application
  • Cloud Application
  • Services
  • Function
  • Desktop Application

1.4 IronPDF Dependencies

1.4.1 For .NET Framework 4.0 support or above

1.4.2. For .NET Standard 2.0 support or above

2. Syncfusion

Today we'll be looking at the PDF Viewer and HTML to PDF Converter products.

If you wish to do your comparison, you can download by following the steps below and examining the code yourself. We also provide full code examples and analysis so you don't have to install both software components.

2.1. PDF Viewer

The main features include that there is no need for Adobe dependency in your target machine. You can Edit and Read PDF files in your .NET application programmatically. It also provides controls to view, review and print PDF files. We can compress or optimize PDF files to minimize file size. It provides a way by which you can convert Excel, Word, PowerPoint, HTML, or image to PDF files.

2.2. HTML to PDF Converter

The HTML to PDF Converter is a component for converting any type of HTML page into a PDF file. It is also possible to convert a specific section of an HTML page into a PDF file by section id. In addition, we also can convert specific images of particular websites to PDF by using its URL. Let's understand how to use it in our projects.

2.3. Install the HTML to PDF Converter

Firstly, we need to install an HTML to PDF converter on our machine. We can install it by downloading the DLL or adding its reference by using the NuGet package manager of our .NET project with the following command line:

>PM> Install-Package Syncfusion.ChromePdfRendererConverter.QtWebKit.AspNet

After installation we need to add the following references to the project:

  • Syncfusion.Compression.Base.dll
  • Syncfusion.Pdf.Base.dll
  • Syncfusion.HtmlConverter.Base.dll

Note: After HTML to PDF converter installation, a folder will be created in the path C:\Program Files (x86)\Syncfusion\HTMLConverter\18.2.0.44\BlinkBinaries. You need to copy this path and use it in the project.

3. Compare: Convert an HTML String to PDF

It is very important to have the functionality to make a PDF file from HTML string in the business application development. It's best to use an efficient component (3rd party tool) to save time. Let's examine the outputs and let you determine the best one.

3.1. Generate a PDF File from HTML Data String with IronPDF

Firstly, we will see how IronPDF works to generate PDF files by HTML string in C#

using IronPdf;
{
    //create rendering converter
    var converter = new ChromePdfRenderer();
    //HTML text
    string HTML_Str = "<h1>Welcome To IronPDF</h1> <h2>HTML String to PDF</h2> <h3>Hello World!</h3>";
    //convert HTML string to PDF file
    using var PDF = converter.RenderHtmlAsPdf(HTML_Str);
    //Save the file
    PDF.SaveAs("sample.pdf");
}
using IronPdf;
{
    //create rendering converter
    var converter = new ChromePdfRenderer();
    //HTML text
    string HTML_Str = "<h1>Welcome To IronPDF</h1> <h2>HTML String to PDF</h2> <h3>Hello World!</h3>";
    //convert HTML string to PDF file
    using var PDF = converter.RenderHtmlAsPdf(HTML_Str);
    //Save the file
    PDF.SaveAs("sample.pdf");
}
Private ReadOnly Property IronPdf() As using
	'create rendering converter
	Dim converter = New ChromePdfRenderer()
	'HTML text
	Dim HTML_Str As String = "<h1>Welcome To IronPDF</h1> <h2>HTML String to PDF</h2> <h3>Hello World!</h3>"
	'convert HTML string to PDF file
	Dim PDF = converter.RenderHtmlAsPdf(HTML_Str)
	'Save the file
	PDF.SaveAs("sample.pdf")
End Property
VB   C#

The following Screenshot is of the newly generated PDF file by the above IronPDF code:

3.2 Generate PDF File from HTML String with Syncfusion

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
{
      //create converter and specify rendering engine
    ChromePdfRendererConverter Converter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
     // initialize blink converter settings
    BlinkConverterSettings Settings = new BlinkConverterSettings();
     //HTML text
    string HTML_Str = "<h1>Welcome To Syncfusion PDF Viewer</h1> <h2>HTML String to PDF</h2> <h3>Hello World!</h3>";
    //Assign BlinkBinaries Folder Path
    Settings.BlinkPath = "BlinkBinaries folder Path";
    //Assign the setting to converter
    Converter.ConverterSettings = Settings;
    string baseUrl = "images and files folder Path";
    //convert HTML string to PDF file
    using PdfDocument PDF = Converter.Convert(HTML_Str, baseUrl);
    //Save the file
    PDF.Save("sample.pdf");
    //Close currently open document
    PDF.Close(true);
}
using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
{
      //create converter and specify rendering engine
    ChromePdfRendererConverter Converter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
     // initialize blink converter settings
    BlinkConverterSettings Settings = new BlinkConverterSettings();
     //HTML text
    string HTML_Str = "<h1>Welcome To Syncfusion PDF Viewer</h1> <h2>HTML String to PDF</h2> <h3>Hello World!</h3>";
    //Assign BlinkBinaries Folder Path
    Settings.BlinkPath = "BlinkBinaries folder Path";
    //Assign the setting to converter
    Converter.ConverterSettings = Settings;
    string baseUrl = "images and files folder Path";
    //convert HTML string to PDF file
    using PdfDocument PDF = Converter.Convert(HTML_Str, baseUrl);
    //Save the file
    PDF.Save("sample.pdf");
    //Close currently open document
    PDF.Close(true);
}
Imports Syncfusion.Pdf
Private ReadOnly Property Syncfusion_HtmlConverter() As using Implements Syncfusion.HtmlConverter
	  'create converter and specify rendering engine
	Dim Converter As New ChromePdfRendererConverter(HtmlRenderingEngine.Blink)
	 ' initialize blink converter settings
	Dim Settings As New BlinkConverterSettings()
	 'HTML text
	Dim HTML_Str As String = "<h1>Welcome To Syncfusion PDF Viewer</h1> <h2>HTML String to PDF</h2> <h3>Hello World!</h3>"
	'Assign BlinkBinaries Folder Path
	Settings.BlinkPath = "BlinkBinaries folder Path"
	'Assign the setting to converter
	Converter.ConverterSettings = Settings
	Dim baseUrl As String = "images and files folder Path"
	'convert HTML string to PDF file
	Using PDF As PdfDocument = Converter.Convert(HTML_Str, baseUrl)
		'Save the file
		PDF.Save("sample.pdf")
		'Close currently open document
		PDF.Close(True)
	End Using
End Property
VB   C#

The following screenshot is of the newly generated PDF file by the above code:

3.3 Comparison Conclusion

We have seen both programming structures and the provided functions. IronPDF has fewer lines of code, with simple naming. On the other hand, Syncfusion has many lines of code with a complex coding structure.

The IronPDF generated file looks more readable, because it automatically sets the margin from the top, left, and right.

4. Compare: Generate PDF from URL

Let's look at another basic use case, needing to make a PDF file against any URL. For this purpose, we see both working code and functionalities.

4.1. URL to PDF with IronPDF

using IronPdf;
{
   //create rendering converter
   var converter = new IronPdf.ChromePdfRenderer();
   //Specify URL 
   using var PDF = converter.RenderUrlAsPdf("URL");
   //Save the file
   PDF.SaveAs("Path + name.pdf");
}
using IronPdf;
{
   //create rendering converter
   var converter = new IronPdf.ChromePdfRenderer();
   //Specify URL 
   using var PDF = converter.RenderUrlAsPdf("URL");
   //Save the file
   PDF.SaveAs("Path + name.pdf");
}
Private ReadOnly Property IronPdf() As using
   'create rendering converter
   Dim converter = New IronPdf.ChromePdfRenderer()
   'Specify URL 
   Dim PDF = converter.RenderUrlAsPdf("URL")
   'Save the file
   PDF.SaveAs("Path + name.pdf")
End Property
VB   C#

4.2. URL to PDF with Syncfusion

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
{
   //create converter and specify rendering engine
   ChromePdfRendererConverter converter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
   // initialize blink converter settings
   BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
   //Assign BlinkBinaries Folder Path
   blinkConverterSettings.BlinkPath ="BlinkBinaries Folder Path";
   //Assign the setting to converter
   converter.ConverterSettings = blinkConverterSettings;
   //Specify URL
   using PdfDocument PDF = converter.Convert("URL");
   //Save the file
   PDF.Save("Path + name.pdf");
   //Close document
   PDF.Close(true);
}
using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
{
   //create converter and specify rendering engine
   ChromePdfRendererConverter converter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
   // initialize blink converter settings
   BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
   //Assign BlinkBinaries Folder Path
   blinkConverterSettings.BlinkPath ="BlinkBinaries Folder Path";
   //Assign the setting to converter
   converter.ConverterSettings = blinkConverterSettings;
   //Specify URL
   using PdfDocument PDF = converter.Convert("URL");
   //Save the file
   PDF.Save("Path + name.pdf");
   //Close document
   PDF.Close(true);
}
Imports Syncfusion.Pdf
Private ReadOnly Property Syncfusion_HtmlConverter() As using Implements Syncfusion.HtmlConverter
   'create converter and specify rendering engine
   Dim converter As New ChromePdfRendererConverter(HtmlRenderingEngine.Blink)
   ' initialize blink converter settings
   Dim blinkConverterSettings As New BlinkConverterSettings()
   'Assign BlinkBinaries Folder Path
   blinkConverterSettings.BlinkPath ="BlinkBinaries Folder Path"
   'Assign the setting to converter
   converter.ConverterSettings = blinkConverterSettings
   'Specify URL
   Using PDF As PdfDocument = converter.Convert("URL")
	   'Save the file
	   PDF.Save("Path + name.pdf")
	   'Close document
	   PDF.Close(True)
   End Using
End Property
VB   C#

Syncfusion Requires a BlinkBinaries Folder Path

What is the BlinkBinaries Folder Path?

When we install, we need to use some basic prerequisite files and DLLs (Dynamic Link Libraries), which exist in the BlinkBinaries folder. This folder will automatically generate in C:\Program Files (x86)\Syncfusion\HTMLConverter after installation (HTML to PDF Converter). Sometimes, it creates some issues when we give a path from C:\ drive. in such a case, we can copy the BlinkBinaries folder and paste it into another drive, and then give its path in the program.

IronPDF Does Not Require Specific Folder Paths

On the other hand, IronPDF does not have these types of requirements, because we do not need to add a specific folder path to the project, nor do we need a special installation on the server. IronPDF's focus is to minimize the developer's work as much as possible and provide a way by which a developer can deal with PDF files without any dependency or prerequisites. So, using IronPDF, you just need to add an IronPDF.dll file in your project and everything is in your hand.

4.3. Comparison Conclusion

The actual document output of both URL to PDF examples is the same, but we can see that there is a big coding difference between the two components.

IronPDF once again provides a simple structure with just a few lines of code. Using Syncfusion, on the other hand, means we have to write many lines of code and establish an extra process with requiring the BlinkBinaries Folder Path.

Let's look at another use case - we want to add a header and footer in the PDF file.

using IronPdf; 
{
   var converter = new IronPdf.ChromePdfRenderer();
   converter.RenderingOptions.MarginTop = 100;
   converter.RenderingOptions.MarginTop = 50;  
   converter.RenderingOptions.MarginBottom = 50;
   converter.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
   //setting Header
   converter.RenderingOptions.TextHeader = new TextHeaderFooter()
   {     
      CenterText = "header title",
      DrawDividerLine = true,
      FontSize = 16,
   };
   //setting Footer
   converter.RenderingOptions.TextFooter = new TextHeaderFooter()
   {
      LeftText = "{date} {time}",
      RightText = "Page {page} of {total-pages}",
      DrawDividerLine = true,
      FontSize = 14      
   };

   var PDF = converter.RenderHtmlAsPdf("<h1>Hello IronPdf</h1>");

   PDF.SaveAs("Path + name.pdf");
}
using IronPdf; 
{
   var converter = new IronPdf.ChromePdfRenderer();
   converter.RenderingOptions.MarginTop = 100;
   converter.RenderingOptions.MarginTop = 50;  
   converter.RenderingOptions.MarginBottom = 50;
   converter.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
   //setting Header
   converter.RenderingOptions.TextHeader = new TextHeaderFooter()
   {     
      CenterText = "header title",
      DrawDividerLine = true,
      FontSize = 16,
   };
   //setting Footer
   converter.RenderingOptions.TextFooter = new TextHeaderFooter()
   {
      LeftText = "{date} {time}",
      RightText = "Page {page} of {total-pages}",
      DrawDividerLine = true,
      FontSize = 14      
   };

   var PDF = converter.RenderHtmlAsPdf("<h1>Hello IronPdf</h1>");

   PDF.SaveAs("Path + name.pdf");
}
Private ReadOnly Property IronPdf() As using
   Dim converter = New IronPdf.ChromePdfRenderer()
   converter.RenderingOptions.MarginTop = 100
   converter.RenderingOptions.MarginTop = 50
   converter.RenderingOptions.MarginBottom = 50
   converter.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print
   'setting Header
   converter.RenderingOptions.TextHeader = New TextHeaderFooter() With {
	   .CenterText = "header title",
	   .DrawDividerLine = True,
	   .FontSize = 16
   }
   'setting Footer
   converter.RenderingOptions.TextFooter = New TextHeaderFooter() With {
	   .LeftText = "{date} {time}",
	   .RightText = "Page {page} of {total-pages}",
	   .DrawDividerLine = True,
	   .FontSize = 14
   }

   Dim PDF = converter.RenderHtmlAsPdf("<h1>Hello IronPdf</h1>")

   PDF.SaveAs("Path + name.pdf")
End Property
VB   C#

When working with IronPDF, you can set the header and footer by predefined qualities using the following properties:

  • CenterText to set the text of the header or footer in Center.
  • LeftText to set the text of the header or footer on the left side.
  • RightText to set the text of the header or footer on the Right side.
  • DrawDividerLine to draw a line to separate the header or footer from the content.
  • FontFamily to set the font family.
  • FontSize to adjust the font size.
  • Spacing to set the space between the header and the content of the page.

To minimize the work for us as developers and maximize performance, IronPDF also provides header and footer attributes that we may need to use in our daily lives.

  • {page} to print the page number.
  • {total-pages} to print the total number of pages.
  • {url} to print the URL of the rendered web page.
  • {date} to print the current date.
  • {time} to print the current time.
  • {html-title} to print the webpage title.
  • {pdf-title} to print the document title.
using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf.Graphics;
{
   PdfDocument PDF = new PdfDocument();
   PdfPage pdfPage = PDF.Pages.Add();
   RectangleF bounds = new RectangleF(0, 0, PDF.Pages[0].GetClientSize().Width, 50);
   PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 24);
   PdfSolidBrush brush = new PdfSolidBrush(System.Drawing.Color.FromArgb(44, 71, 120));
   //Setting Page Header
   PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);         
   header.Graphics.DrawString("Hello Title", font, brush, bounds);
   PDF.Template.Top = header;
   //Setting Page Footer
   PdfPageTemplateElement footer = new PdfPageTemplateElement(bounds);          
   footer.Graphics.DrawString("Footer", font, brush, bounds);
   PDF.Template.Bottom = footer;
   //save the file
   PDF.Save("Path + name.pdf");
}
using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf.Graphics;
{
   PdfDocument PDF = new PdfDocument();
   PdfPage pdfPage = PDF.Pages.Add();
   RectangleF bounds = new RectangleF(0, 0, PDF.Pages[0].GetClientSize().Width, 50);
   PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 24);
   PdfSolidBrush brush = new PdfSolidBrush(System.Drawing.Color.FromArgb(44, 71, 120));
   //Setting Page Header
   PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);         
   header.Graphics.DrawString("Hello Title", font, brush, bounds);
   PDF.Template.Top = header;
   //Setting Page Footer
   PdfPageTemplateElement footer = new PdfPageTemplateElement(bounds);          
   footer.Graphics.DrawString("Footer", font, brush, bounds);
   PDF.Template.Bottom = footer;
   //save the file
   PDF.Save("Path + name.pdf");
}
Imports Syncfusion.Pdf
Imports Syncfusion.HtmlConverter
Private ReadOnly Property Pdf_Graphics() As using Implements Syncfusion.Pdf.Graphics
   Dim PDF As New PdfDocument()
   Dim pdfPage As PdfPage = PDF.Pages.Add()
   Dim bounds As New RectangleF(0, 0, PDF.Pages(0).GetClientSize().Width, 50)
   Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 24)
   Dim brush As New PdfSolidBrush(System.Drawing.Color.FromArgb(44, 71, 120))
   'Setting Page Header
   Dim header As New PdfPageTemplateElement(bounds)
   header.Graphics.DrawString("Hello Title", font, brush, bounds)
   PDF.Template.Top = header
   'Setting Page Footer
   Dim footer As New PdfPageTemplateElement(bounds)
   footer.Graphics.DrawString("Footer", font, brush, bounds)
   PDF.Template.Bottom = footer
   'save the file
   PDF.Save("Path + name.pdf")
End Property
VB   C#

5.3. Comparison Conclusion

When we use Syncfusion, we need to work with graphics to print the header and footer on PDF pages. It does not use the .NET graphics library, it has its library and programming structure, which can be difficult to work with and requires an extra step.

For example, if we want to print the current page number of total pages, we would have to write the following lines of code:

//font and brush are defined in the above sample code
PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush);
PdfPageCountField count = new PdfPageCountField(font, brush);
PdfCompositeField compositeField = new PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count);
compositeField.Bounds = footer.Bounds;
compositeField.Draw(footer.Graphics, new PointF(470, 40));
PDF.Template.Bottom = footer;
//font and brush are defined in the above sample code
PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush);
PdfPageCountField count = new PdfPageCountField(font, brush);
PdfCompositeField compositeField = new PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count);
compositeField.Bounds = footer.Bounds;
compositeField.Draw(footer.Graphics, new PointF(470, 40));
PDF.Template.Bottom = footer;
'font and brush are defined in the above sample code
Dim pageNumber As New PdfPageNumberField(font, brush)
Dim count As New PdfPageCountField(font, brush)
Dim compositeField As New PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count)
compositeField.Bounds = footer.Bounds
compositeField.Draw(footer.Graphics, New PointF(470, 40))
PDF.Template.Bottom = footer
VB   C#

On the other hand, By using IronPDF, we can complete the same task with one line:

Page {page} of {total-pages}
Page {page} of {total-pages}
Page
If True Then
	page
End If
[of]
If True Then
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'	total-pages}
VB   C#

6. Compare: Add Watermark

Another common requirement is to add a WaterMark to the PDF file. Suppose that we want to add this watermark by the following aspects:

  • on a specific page
  • on selected pages
  • on all pages.

Let's compare how to accomplish each of these using the two different software components.

6.1. Add Watermark to 1 Specific Page with IronPDF

Let's convert a URL to a PDF document with multiple pages, but only add a watermark to one specific page, with the rest staying the same.

To add a WaterMark on a specific page, IronPDF provides the WatermarkPage() function, and it takes different types of parameters to set the WaterMark.

We can define this function:

WatermarkPage(Text, PageIndex, WaterMarkLocation,  Opacity, Rotation, Hyperlink);
WatermarkPage(Text, PageIndex, WaterMarkLocation,  Opacity, Rotation, Hyperlink);
WatermarkPage(Text, PageIndex, WaterMarkLocation, Opacity, Rotation, Hyperlink)
VB   C#
  • Text is a string that is written as a WaterMark.
  • PageIndex is the page number where WaterMark is to be added
  • WaterMarkLocation to set the location of WaterMark text, it can be adjusted with the following: TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight
  • Opacity is to set transparency
  • Rotation is to set the angle of text
  • Hyperlink to attach a link to the WaterMark

Text would be in HTML format and we can set its styling properties using CSS or javascript as:

string Text = "<h2 style='color:red'>Hello WaterMark</h2>";
string Text = "<h2 style='color:red'>Hello WaterMark</h2>";
Dim Text As String = "<h2 style='color:red'>Hello WaterMark</h2>"
VB   C#

Now, let's see the full example of how to add WaterMark on the specific page using IronPDF in C#:

using IronPdf
{
    var converter = new ChromePdfRenderer();
    using var pdf= converter.RenderUrlAsPdf("https://yandex.com/");
    pdf.WatermarkPage("<h2 style='color:red'>Sample Water Mark</h2>", 0, PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45);
    pdf.SaveAs("sample.pdf"); 
}
using IronPdf
{
    var converter = new ChromePdfRenderer();
    using var pdf= converter.RenderUrlAsPdf("https://yandex.com/");
    pdf.WatermarkPage("<h2 style='color:red'>Sample Water Mark</h2>", 0, PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45);
    pdf.SaveAs("sample.pdf"); 
}
Private ReadOnly Property IronPdf() As using
	Dim converter = New ChromePdfRenderer()
	Dim pdf= converter.RenderUrlAsPdf("https://yandex.com/")
	pdf.WatermarkPage("<h2 style='color:red'>Sample Water Mark</h2>", 0, PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45)
	pdf.SaveAs("sample.pdf")
End Property
VB   C#

Here is a screenshot of the generated PDF document "sample.pdf":

6.2. Add Watermark to One Specific Page with Syncfusion

To add a watermark in a PDF file using, you must first learn how to work with this specific PDF graphics library. You can not use the Microsoft graphics library.

Note: You also need to add the BlinkBinaries folder path in your project. This folder will be created after Installation in C:\Program Files (x86)\Syncfusion.

Now, let's see the example of how to add a WaterMark on the specific page.

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf.Graphics;
{
    ChromePdfRendererConverter htmlConverter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
    BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
    blinkConverterSettings.BlinkPath = "BlinkBinaries Folder Path";
    htmlConverter.ConverterSettings = blinkConverterSettings;
    PdfDocument document = htmlConverter.Convert("https://yandex.com/");
    PdfPageBase pdfPage = document.Pages[0];
    PdfGraphics graphics = pdfPage.Graphics;
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 15);
    PdfGraphicsState state = graphics.Save();
    graphics.SetTransparency(0.7f);
    graphics.RotateTransform(-40);
    graphics.DrawString("Sample Water Mark", font, PdfPens.Red, PdfBrushes.Red, new PointF(-100, 550));
    document.Save("sample.pdf");
    document.Close(true);
    }
using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf.Graphics;
{
    ChromePdfRendererConverter htmlConverter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
    BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
    blinkConverterSettings.BlinkPath = "BlinkBinaries Folder Path";
    htmlConverter.ConverterSettings = blinkConverterSettings;
    PdfDocument document = htmlConverter.Convert("https://yandex.com/");
    PdfPageBase pdfPage = document.Pages[0];
    PdfGraphics graphics = pdfPage.Graphics;
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 15);
    PdfGraphicsState state = graphics.Save();
    graphics.SetTransparency(0.7f);
    graphics.RotateTransform(-40);
    graphics.DrawString("Sample Water Mark", font, PdfPens.Red, PdfBrushes.Red, new PointF(-100, 550));
    document.Save("sample.pdf");
    document.Close(true);
    }
Imports Syncfusion.Pdf
Imports Syncfusion.HtmlConverter
Private ReadOnly Property Pdf_Graphics() As using Implements Syncfusion.Pdf.Graphics
	Dim htmlConverter As New ChromePdfRendererConverter(HtmlRenderingEngine.Blink)
	Dim blinkConverterSettings As New BlinkConverterSettings()
	blinkConverterSettings.BlinkPath = "BlinkBinaries Folder Path"
	htmlConverter.ConverterSettings = blinkConverterSettings
	Dim document As PdfDocument = htmlConverter.Convert("https://yandex.com/")
	Dim pdfPage As PdfPageBase = document.Pages(0)
'INSTANT VB NOTE: The local variable graphics was renamed since Visual Basic will not allow local variables with the same name as their enclosing function or property:
	Dim graphics_Conflict As PdfGraphics = pdfPage.Graphics
	Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 15)
	Dim state As PdfGraphicsState = graphics_Conflict.Save()
	graphics_Conflict.SetTransparency(0.7F)
	graphics_Conflict.RotateTransform(-40)
	graphics_Conflict.DrawString("Sample Water Mark", font, PdfPens.Red, PdfBrushes.Red, New PointF(-100, 550))
	document.Save("sample.pdf")
	document.Close(True)
End Property
VB   C#

With the following screenshot of the generated PDF document sample.pdf:

6.3. Add Watermark to Selected Pages with IronPDF

IronPDF provides a simple way for when you need to add a WaterMark on many pages, but not all of them. For this purpose, we can use `WatermarkPages(), and it can be defined as:

WatermarkPages(Text, Array of page Indexes, WaterMarkLocation, Opacity, Rotation, Hyperlink);
WatermarkPages(Text, Array of page Indexes, WaterMarkLocation, Opacity, Rotation, Hyperlink);
WatermarkPages(Text, Array [of] page Indexes, WaterMarkLocation, Opacity, Rotation, Hyperlink)
VB   C#

In this function, all of the parameters work the same as the above function, but with the new element of Array of page Indexes:

An array of page Indexes is an array of integers to define on which pages the WaterMark is to be added.

Just suppose that if we want to add WaterMark "Text" just on pages "1", "3", "5" of the PDF file, then we would do the following. The rest of the pages remain the same.

pdf.WatermarkPages("<h2 style='color:red'>SAMPLE</h2>", new[] {1,3,5 }, PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45);
pdf.WatermarkPages("<h2 style='color:red'>SAMPLE</h2>", new[] {1,3,5 }, PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45);
pdf.WatermarkPages("<h2 style='color:red'>SAMPLE</h2>", {1,3,5 }, PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45)
VB   C#

6.4. Add Watermark to Selected Pages with Syncfusion

There is no predefined function to apply a watermark to specific pages. Instead, it can be possible by making your programming structure using loop and conditions. In this way, the programming structure becomes complex and we have to write many lines of code.

6.5. Add WaterMark on All Pages with IronPDF

IronPDF provides a predefined function for this common requirement, to add a WaterMark on all pages, named WatermarkAllPages(). There is no need for iteration for adding the WaterMark on each page separately, just call the function once and the WaterMark would be added on each page of the PDF file. Let's see the following example:

using IronPdf 
{
  var converter = new ChromePdfRenderer();
  using var pdf= converter.RenderUrlAsPdf("URL");
  pdf.WatermarkAllPages("<h2 style='color:red'>SAMPLE</h2>", PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45);
  pdf.SaveAs("sample.pdf");
}
using IronPdf 
{
  var converter = new ChromePdfRenderer();
  using var pdf= converter.RenderUrlAsPdf("URL");
  pdf.WatermarkAllPages("<h2 style='color:red'>SAMPLE</h2>", PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45);
  pdf.SaveAs("sample.pdf");
}
Private ReadOnly Property IronPdf() As using
  Dim converter = New ChromePdfRenderer()
  Dim pdf= converter.RenderUrlAsPdf("URL")
  pdf.WatermarkAllPages("<h2 style='color:red'>SAMPLE</h2>", PdfDocument.WaterMarkLocation.MiddleCenter, 50, -45)
  pdf.SaveAs("sample.pdf")
End Property
VB   C#

6.6. Add WaterMark on All Pages with Syncfusion

In this case again there is no predefined function for adding a WaterMark on all pages of a PDF file.

It can be done by iterating the PDF page. In this way, the WaterMark will be added on an iterated page one by one. Iteration can be done using for or while loops. Let's see the following example of how to add WaterMark.

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf.Graphics;
{
    ChromePdfRendererConverter htmlConverter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
    BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
    blinkConverterSettings.BlinkPath ="BlinkBinaries Folder Path";
    blinkConverterSettings.EnableJavaScript = false;
    htmlConverter.ConverterSettings = blinkConverterSettings;
    PdfDocument document = htmlConverter.Convert("URL");

    for (int i = 0; i < document.Pages.Count; i++)
    {
        PdfPageBase pdfPage = document.Pages[i];
        PdfGraphics graphics = pdfPage.Graphics;
        PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
        PdfGraphicsState state = graphics.Save();
        graphics.SetTransparency(0.25f);
        graphics.RotateTransform(-40);
        graphics.DrawString("Sample", font, PdfPens.Red, PdfBrushes.Red, new PointF(-150, 450));

    }
    document.Save("sample.pdf");
    document.Close(true);
}
using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf.Graphics;
{
    ChromePdfRendererConverter htmlConverter = new ChromePdfRendererConverter(HtmlRenderingEngine.Blink);
    BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
    blinkConverterSettings.BlinkPath ="BlinkBinaries Folder Path";
    blinkConverterSettings.EnableJavaScript = false;
    htmlConverter.ConverterSettings = blinkConverterSettings;
    PdfDocument document = htmlConverter.Convert("URL");

    for (int i = 0; i < document.Pages.Count; i++)
    {
        PdfPageBase pdfPage = document.Pages[i];
        PdfGraphics graphics = pdfPage.Graphics;
        PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
        PdfGraphicsState state = graphics.Save();
        graphics.SetTransparency(0.25f);
        graphics.RotateTransform(-40);
        graphics.DrawString("Sample", font, PdfPens.Red, PdfBrushes.Red, new PointF(-150, 450));

    }
    document.Save("sample.pdf");
    document.Close(true);
}
Imports Syncfusion.Pdf
Imports Syncfusion.HtmlConverter
Private ReadOnly Property Pdf_Graphics() As using Implements Syncfusion.Pdf.Graphics
	Dim htmlConverter As New ChromePdfRendererConverter(HtmlRenderingEngine.Blink)
	Dim blinkConverterSettings As New BlinkConverterSettings()
	blinkConverterSettings.BlinkPath ="BlinkBinaries Folder Path"
	blinkConverterSettings.EnableJavaScript = False
	htmlConverter.ConverterSettings = blinkConverterSettings
	Dim document As PdfDocument = htmlConverter.Convert("URL")

	For i As Integer = 0 To document.Pages.Count - 1
		Dim pdfPage As PdfPageBase = document.Pages(i)
'INSTANT VB NOTE: The local variable graphics was renamed since Visual Basic will not allow local variables with the same name as their enclosing function or property:
		Dim graphics_Conflict As PdfGraphics = pdfPage.Graphics
		Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 20)
		Dim state As PdfGraphicsState = graphics_Conflict.Save()
		graphics_Conflict.SetTransparency(0.25F)
		graphics_Conflict.RotateTransform(-40)
		graphics_Conflict.DrawString("Sample", font, PdfPens.Red, PdfBrushes.Red, New PointF(-150, 450))

	Next i
	document.Save("sample.pdf")
	document.Close(True)
End Property
VB   C#

For more about how to iterate and add watermark, you can read more.

7. Compare: Licensing

When we need to choose one product from two, pricing plays a very important role in deciding which product we should choose. We can't deny the importance of component license pricing. In business application development companies, it is very important how we might complete the project with the minimum usage of resources and budget. For this purpose, we compare the licensing offerings.

IronPDF provides useful packages for customers based on several developers, as well as SaaS and OEM redistribution options. You can read more about IronPDF licensing or get a personalized walkthrough for your license needs by contacting the team.

Alternatively, Syncfusion does not have any predefined packages for companies, but it sets the price only after knowing your company information.


Tutorial Quick Access

Download the C# HTML to PDF Quickstart Guide

Use the guide to make it easier to develop PDFs for .NET, including functions for manipulating, editing, generating, and saving PDFS in C# and VB.NET for your project.

Download the Guide

Read the IronPDF Documentation

Explore the API Reference for the IronPDF Library, with features, classes, method fields, namespaces, and enums.

View the API Reference