Skip to content

Commit f316336

Browse files
committed
991451: Updated proper code example for offline mode.
1 parent 52aa93f commit f316336

File tree

2 files changed

+20
-12
lines changed
  • HTML to PDF/Blink/Convert-HTML-to-PDF-in-offline-mode/.NET/Convert-HTML-to-PDF-in-offline-mode

2 files changed

+20
-12
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<head>
3+
</head>
4+
<body>
5+
<h1>Heading 1</h1>
6+
<h2>Heading 2</h2>
7+
<h3>Heading 3</h3>
8+
<h4>Heading 4</h4>
9+
<h5>Heading 5</h5>
10+
<h6>Heading 6</h6>
11+
</body>
12+
</html>
13+
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
using Syncfusion.HtmlConverter;
22
using Syncfusion.Pdf;
3-
using System.Runtime.InteropServices;
43

54
//Initialize the HTML to PDF converter.
65
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
7-
8-
//Initialize blink converter settings.
96
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
107

11-
//Enable offline mode.
8+
//Enable offline mode
129
blinkConverterSettings.EnableOfflineMode = true;
1310

14-
//Assign Blink converter settings to HTML converter.
11+
//Assign Blink converter settings to HTML converter
1512
htmlConverter.ConverterSettings = blinkConverterSettings;
16-
17-
//Convert URL to PDF document.
18-
PdfDocument document = htmlConverter.Convert("https://www.google.com");
19-
20-
//Save the PDF document
21-
document.Save(fileStream);
22-
//Close the document.
13+
string inputHTML = Path.GetFullPath(@"Data/Input.html");
14+
//Convert URL to PDF
15+
PdfDocument document = htmlConverter.Convert(inputHTML);
16+
//Save and close the PDF document.
17+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
2318
document.Close(true);

0 commit comments

Comments
 (0)