Skip to content

Commit cbbf227

Browse files
Merge pull request #2384 from Syncfusion-Content/hotfix/hotfix-v32.2.3
DOCINFRA-2341_merged_using_automation
2 parents c079396 + d32494b commit cbbf227

25 files changed

Lines changed: 302 additions & 0 deletions

Document-Processing-toc.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,9 @@
30913091
<li>
30923092
<a href="/document-processing/pdf/conversions/html-to-pdf/net/docker">Docker</a>
30933093
</li>
3094+
<li>
3095+
<a href="/document-processing/pdf/conversions/html-to-pdf/net/Convert-HTML-to-PDF-in-Windows-Server">Windows Server</a>
3096+
</li>
30943097
<li>
30953098
<a href="/document-processing/pdf/conversions/html-to-pdf/net/Convert-HTML-to-PDF-in-GCP">Google Cloud Platform (GCP)</a>
30963099
<ul>
@@ -7524,6 +7527,9 @@
75247527
<li>
75257528
<a href="/document-processing/powerpoint/conversions/powerpoint-to-image/net/Convert-PowerPoint-to-Image-in-Azure-Functions-v4">Azure Functions v4</a>
75267529
</li>
7530+
<li>
7531+
<a href="/document-processing/powerpoint/conversions/powerpoint-to-image/net/Convert-PowerPoint-to-Image-in-Azure-Functions-Flex-Consumption">Azure Functions Flex Consumption</a>
7532+
</li>
75277533
</ul>
75287534
</li>
75297535
<li>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: Convert HTML to PDF on the Windows Server | Syncfusion
3+
description: Learn how to convert HTML to PDF on a Windows Server using IIS Manager with clear and simple guidance.
4+
platform: document-processing
5+
control: PDF
6+
documentation: UG
7+
keywords: create pdf on windows server, generate pdf on windows server, syncfusion html to pdf, host pdf converter in iis
8+
---
9+
10+
# Convert HTML to PDF on the Windows Server using IIS Manager
11+
12+
The Syncfusion<sup>&reg;</sup> HTML to PDF converter is a .NET library for converting webpages, SVG, MHTML, and HTML to PDF using C#. Using this library, convert HTML to PDF document on the Windows Server using IIS Manager.
13+
14+
## Steps to convert HTML to PDF on the windows server using IIS manager
15+
16+
Step 1: Create a new C# ASP.NET Web Application (.NET Framework) project.
17+
![Create ASP.NET MVC application](htmlconversion_images/aspnetmvc1.png)
18+
19+
Step 2: In the Create a new ASP.NET Web Application window, choose the MVC template and click Next to proceed.
20+
![Configuration window](htmlconversion_images/aspnetmvc3.png)
21+
22+
Step 3: Install [Syncfusion.HtmlToPdfConverter.Net.Windows](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Windows) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/).
23+
![NuGet Package](htmlconversion_images/nuget-package-window.png)
24+
25+
Step 4: Include the following namespaces in the HomeController.cs file.
26+
27+
{% highlight c# tabtitle="C#" %}
28+
29+
using Syncfusion.Pdf;
30+
using Syncfusion.HtmlConverter;
31+
using System.IO;
32+
33+
{% endhighlight %}
34+
35+
Step 5: Add a new button in the Index.cshtml as shown below.
36+
37+
{% highlight c# tabtitle="C#" %}
38+
39+
@{Html.BeginForm("ExportToPDF", "Home", FormMethod.Post);
40+
{
41+
<div>
42+
<input type="submit" value="Convert PDF" style="width:150px;height:27px" />
43+
</div>
44+
}
45+
Html.EndForm();
46+
}
47+
48+
{% endhighlight %}
49+
50+
Step 6: Add a new action method named ExportToPDF in HomeController.cs and include the below code example to convert HTML to PDF document using [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_) method in [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class.
51+
52+
{% highlight c# tabtitle="C#" %}
53+
54+
//Initialize HTML to PDF converter.
55+
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
56+
//Convert URL to PDF document.
57+
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com");
58+
//Create memory stream.
59+
MemoryStream stream = new MemoryStream();
60+
//Save the document to memory stream.
61+
document.Save(stream);
62+
document.Close(true);
63+
return File(stream.ToArray(), System.Net.Mime.MediaTypeNames.Application.Pdf, "HTML-to-PDF.pdf");
64+
65+
{% endhighlight %}
66+
67+
Step 7: Run the project and verify that the HTML‑to‑PDF conversion functions correctly in the local environment.
68+
69+
## Publish the project to a Windows Server using IIS
70+
71+
Step 1: Publish the project to a local folder by right‑clicking the project, selecting **Publish**, choosing the **Folder** option, and clicking **Next**.
72+
![IIS Folder](htmlconversion_images/IIS-Folder.png)
73+
74+
Step 2: Provide the folder path where the project should be published.
75+
![IIS Folder Path](htmlconversion_images/IIS-Browser.png)
76+
77+
Step 3: After creating the publish profile, Visual Studio opens the Publish dashboard. Review the target location, configuration, and other settings, and adjust them if necessary. Once everything looks correct, click **Publish** to deploy the application to the selected destination.
78+
![IIS Publish](htmlconversion_images/IIS-Publish.png)
79+
80+
Step 4: It will generate and publish all necessary files to the local publish directory.
81+
![IIS Local Folder Path](htmlconversion_images/IIS-localfolder.png)
82+
83+
Step 5: Copy the published output folder to the server and host the application in IIS.
84+
i.Open **IIS Manager** on the server and create a new website.
85+
86+
ii.Enter a **site name** and select the **physical path** that points to the published output folder on the server.
87+
![IIS Website](htmlconversion_images/IIS-Website.png)
88+
89+
iii. Obtain the server’s IP address after adding the website in the local IIS server.
90+
91+
iv. From your local computer, browse the website using the server’s IP address and port number. Once the site loads successfully, export the webpage to PDF.
92+
![IIS Browser](htmlconversion_images/IIS-RunBrowser.png)
93+
94+
A complete working sample is available for download from GitHub.
95+
96+
Click the button to convert the Syncfusion<sup>&reg;</sup> webpage into a PDF document. The generated PDF will appear as shown below.
97+
![IIS Output document](htmlconversion_images/IIS-Output.png)
18.7 KB
Loading
29 KB
Loading
69.4 KB
Loading
25.7 KB
Loading
23.6 KB
Loading
58.3 KB
Loading
58.6 KB
Loading
74 KB
Loading

0 commit comments

Comments
 (0)