Skip to content

Commit 7c506af

Browse files
committed
994279: Resolved the given feedback.
1 parent cffd040 commit 7c506af

File tree

1 file changed

+17
-15
lines changed
  • HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering

1 file changed

+17
-15
lines changed

HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@
1616
htmlConverter.ConverterSettings = blinkConverterSettings;
1717
// Read the main HTML content and convert it to PDF
1818
string inputhtml = File.ReadAllText(Path.GetFullPath(@"Data/input.html"));
19-
PdfDocument document = htmlConverter.Convert(inputhtml, "");
20-
// Create new settings for scaling the cover page
21-
BlinkConverterSettings settings = new BlinkConverterSettings();
22-
settings.Scale = 1.5f;
23-
// Apply scaling settings
24-
htmlConverter.ConverterSettings = settings;
25-
// Convert the cover page HTML to PDF
26-
string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html"));
27-
PdfDocument coverPage = htmlConverter.Convert(coverimage, "");
28-
// Insert the cover page at the beginning of the main document
29-
document.Pages.Insert(0, coverPage.Pages[0]);
30-
// Save the PDF document
31-
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
32-
// Close the PDF document
33-
document.Close(true);
19+
using (PdfDocument document = htmlConverter.Convert(inputhtml, ""))
20+
{
21+
// Apply scaling settings for the cover page
22+
htmlConverter.ConverterSettings = new BlinkConverterSettings()
23+
{
24+
Scale = 1.5f
25+
};
26+
// Convert the cover page HTML to PDF
27+
string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html"));
28+
using (PdfDocument coverPage = htmlConverter.Convert(coverimage, ""))
29+
{
30+
// Insert the cover page at the beginning of the main document
31+
document.Pages.Insert(0, coverPage.Pages[0]);
32+
// Save the PDF document
33+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
34+
}
35+
}

0 commit comments

Comments
 (0)