-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
160e728
commit 3033907
Showing
12 changed files
with
264 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
HTML to PDF/Blink/Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.3.32819.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inject_custom_CSS_to_HTML", "Inject_custom_CSS_to_HTML\Inject_custom_CSS_to_HTML.csproj", "{A00BDA8D-F1AB-4CB0-B97D-9A80631F6BB4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A00BDA8D-F1AB-4CB0-B97D-9A80631F6BB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A00BDA8D-F1AB-4CB0-B97D-9A80631F6BB4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A00BDA8D-F1AB-4CB0-B97D-9A80631F6BB4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A00BDA8D-F1AB-4CB0-B97D-9A80631F6BB4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {FC291101-A10D-4F23-8A31-BDC2251AE445} | ||
EndGlobalSection | ||
EndGlobal |
14 changes: 14 additions & 0 deletions
14
...Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML/Inject_custom_CSS_to_HTML.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.HtmlToPdfConverter.Net.Windows" Version="23.1.38" /> | ||
</ItemGroup> | ||
|
||
</Project> |
23 changes: 23 additions & 0 deletions
23
HTML to PDF/Blink/Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.Drawing; | ||
using Syncfusion.HtmlConverter; | ||
using Syncfusion.Pdf; | ||
|
||
//Initialize the HTML to PDF converter. | ||
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); | ||
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); | ||
//Set the Blink viewport size. | ||
blinkConverterSettings.ViewPortSize = new Size(1280, 0); | ||
blinkConverterSettings.Margin.All = 30; | ||
//Set the custom CSS | ||
blinkConverterSettings.Css = "body {\r\n background-color: lightyellow; \r\n}"; | ||
htmlConverter.ConverterSettings = blinkConverterSettings; | ||
//Convert the URL to PDF document. | ||
PdfDocument document = htmlConverter.Convert("https://www.google.com"); | ||
|
||
//Create file stream. | ||
FileStream fileStream = new FileStream("../../../HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); | ||
//Save and close the PDF document. | ||
document.Save(fileStream); | ||
document.Close(true); |
25 changes: 25 additions & 0 deletions
25
HTML to PDF/Blink/Inject_custom_JavaScript_to_HTML/.NET/Inject_custom_JavaScript_to_HTML.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.3.32819.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inject_custom_JavaScript_to_HTML", "Inject_custom_JavaScript_to_HTML\Inject_custom_JavaScript_to_HTML.csproj", "{634C42CC-B7A6-406F-AC6B-50E5D9FCEF7C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{634C42CC-B7A6-406F-AC6B-50E5D9FCEF7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{634C42CC-B7A6-406F-AC6B-50E5D9FCEF7C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{634C42CC-B7A6-406F-AC6B-50E5D9FCEF7C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{634C42CC-B7A6-406F-AC6B-50E5D9FCEF7C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {CF5A3C10-D91E-4031-83C3-D3D28685BCEB} | ||
EndGlobalSection | ||
EndGlobal |
14 changes: 14 additions & 0 deletions
14
...ipt_to_HTML/.NET/Inject_custom_JavaScript_to_HTML/Inject_custom_JavaScript_to_HTML.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.HtmlToPdfConverter.Net.Windows" Version="23.1.38" /> | ||
</ItemGroup> | ||
|
||
</Project> |
28 changes: 28 additions & 0 deletions
28
...F/Blink/Inject_custom_JavaScript_to_HTML/.NET/Inject_custom_JavaScript_to_HTML/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.Drawing; | ||
using Syncfusion.HtmlConverter; | ||
using Syncfusion.Pdf; | ||
using System.IO; | ||
|
||
//Initialize the HTML to PDF converter. | ||
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); | ||
|
||
//Initialize the blink converter settings. | ||
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); | ||
//Set the Blink viewport size. | ||
blinkConverterSettings.ViewPortSize = new Size(1280, 0); | ||
blinkConverterSettings.Margin.All = 30; | ||
|
||
//Set the Custom JavaScript | ||
blinkConverterSettings.JavaScript = "document.querySelectorAll('img').forEach((node)=>{node.remove();})"; | ||
htmlConverter.ConverterSettings = blinkConverterSettings; | ||
|
||
//Convert the URL to PDF document. | ||
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); | ||
|
||
//Create a filestream. | ||
FileStream fileStream = new FileStream("../../../HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); | ||
//Save and close the PDF document. | ||
document.Save(fileStream); | ||
document.Close(true); |
25 changes: 25 additions & 0 deletions
25
HTML to PDF/Blink/Optimize-HTML-to-PDF-performance/.NET/Optimize-HTML-to-PDF-performance.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.3.32819.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Optimize-HTML-to-PDF-performance", "Optimize-HTML-to-PDF-performance\Optimize-HTML-to-PDF-performance.csproj", "{4613D841-222D-4A43-A27F-AA8C29A6F195}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{4613D841-222D-4A43-A27F-AA8C29A6F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4613D841-222D-4A43-A27F-AA8C29A6F195}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4613D841-222D-4A43-A27F-AA8C29A6F195}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4613D841-222D-4A43-A27F-AA8C29A6F195}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {4F1700C7-9DA0-47F7-94D0-7C97A709821A} | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
...performance/.NET/Optimize-HTML-to-PDF-performance/Optimize-HTML-to-PDF-performance.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>Optimize_HTML_to_PDF_performance</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.HtmlToPdfConverter.Net.Windows" Version="23.1.38" /> | ||
</ItemGroup> | ||
|
||
</Project> |
36 changes: 36 additions & 0 deletions
36
...F/Blink/Optimize-HTML-to-PDF-performance/.NET/Optimize-HTML-to-PDF-performance/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.HtmlConverter; | ||
using Syncfusion.Pdf; | ||
using System.IO; | ||
|
||
//Initialize the HTML to PDF converter. | ||
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); | ||
//Reuse the browser instance. | ||
htmlConverter.ReuseBrowserProcess = true; | ||
|
||
//Create PDF document. | ||
PdfDocument document = new PdfDocument(); | ||
//Create memory stream. | ||
MemoryStream memoryStream = new MemoryStream(); | ||
|
||
for (int i = 0; i < 10; i++) | ||
{ | ||
//Initialize the blink converter settings. | ||
BlinkConverterSettings settings = new BlinkConverterSettings(); | ||
settings.AdditionalDelay = 1000; | ||
settings.EnableJavaScript = true; | ||
//Assign the settings to HTML converter. | ||
htmlConverter.ConverterSettings = settings; | ||
|
||
//Convert the URL to PDF document. | ||
document = htmlConverter.Convert("https://www.google.com"); | ||
|
||
//Save and close the PDF document. | ||
document.Save(memoryStream); | ||
document.Close(true); | ||
File.WriteAllBytes("ReuseBrowserProcess" + Guid.NewGuid().ToString() + ".pdf", memoryStream.ToArray()); | ||
} | ||
|
||
//Close HTML converter. | ||
htmlConverter.Close(); |
25 changes: 25 additions & 0 deletions
25
HTML to PDF/Blink/Set_blink_path_in_HTML_to_PDF/.NET/Set_blink_path_in_HTML_to_PDF.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.3.32819.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set_blink_path_in_HTML_to_PDF", "Set_blink_path_in_HTML_to_PDF\Set_blink_path_in_HTML_to_PDF.csproj", "{DCE10516-E8CB-4FE2-9AF2-6AFF2DE04026}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{DCE10516-E8CB-4FE2-9AF2-6AFF2DE04026}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{DCE10516-E8CB-4FE2-9AF2-6AFF2DE04026}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{DCE10516-E8CB-4FE2-9AF2-6AFF2DE04026}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{DCE10516-E8CB-4FE2-9AF2-6AFF2DE04026}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {A2535A2F-9E26-4961-88B6-733DDA34D313} | ||
EndGlobalSection | ||
EndGlobal |
20 changes: 20 additions & 0 deletions
20
... to PDF/Blink/Set_blink_path_in_HTML_to_PDF/.NET/Set_blink_path_in_HTML_to_PDF/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.HtmlConverter; | ||
using Syncfusion.Pdf; | ||
|
||
//Initialize HTML to PDF converter. | ||
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); | ||
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); | ||
//Set Blink binaries path. | ||
blinkConverterSettings.BlinkPath = @"../../../BlinkBinaries/"; | ||
//Assign Blink converter settings to HTML converter. | ||
htmlConverter.ConverterSettings = blinkConverterSettings; | ||
//Convert URL to PDF document. | ||
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); | ||
|
||
//Create file stream to save the PDF document. | ||
FileStream fileStream = new FileStream("../../../HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); | ||
//Save and close the PDF document. | ||
document.Save(fileStream); | ||
document.Close(true); |
14 changes: 14 additions & 0 deletions
14
...th_in_HTML_to_PDF/.NET/Set_blink_path_in_HTML_to_PDF/Set_blink_path_in_HTML_to_PDF.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.HtmlToPdfConverter.Net.Windows" Version="23.1.38" /> | ||
</ItemGroup> | ||
|
||
</Project> |