File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 11using Syncfusion . HtmlConverter ;
22using Syncfusion . Pdf ;
3- using System . Runtime . InteropServices ;
43
54//Initialize the HTML to PDF converter.
65HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter ( ) ;
7-
8- //Initialize blink converter settings.
96BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings ( ) ;
107
11- //Enable offline mode.
8+ //Enable offline mode
129blinkConverterSettings . EnableOfflineMode = true ;
1310
14- //Assign Blink converter settings to HTML converter.
11+ //Assign Blink converter settings to HTML converter
1512htmlConverter . 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" ) ) ;
2318document . Close ( true ) ;
You can’t perform that action at this time.
0 commit comments