Skip to content

Commit e6497c5

Browse files
authored
Merge pull request #1 from 3CS-Software/skia-sharp-target
Skia sharp target
2 parents 2c69713 + 1139de6 commit e6497c5

29 files changed

+2070
-60
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@ UpgradeLog*.XML
109109

110110
*.DotSettings
111111
/Source/.vs/
112+
/Source/Demo/Console/HtmlRenderer.Demo.Console/Output

Source/Demo/Common/TestSamples/06.External Image.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div>
99
From web:
1010
</div>
11-
<img height="100" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg"/>
11+
<img height="100" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg"/>
1212
<hr />
1313
<div>
1414
GIF:
@@ -21,6 +21,6 @@
2121
<img height="100" byevent="1000"/>
2222
<br/>
2323
<br/>
24-
<img style="width: 100%" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg"/>
24+
<img style="width: 100%" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg"/>
2525
</body>
2626
</html>

Source/Demo/Common/TestSamples/15.MaxWidth.htm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ <h2>
2626
metus. Integer leo dolor, tristique a, dignissim ac, iaculis eget, elit. Donec arcu.
2727
</p>
2828
<div>The image should also be limited by size because it has: <code><span color="red">style</span><span color="blue">="</span><span color="maroon">width</span><span color="blue">:90%"</span></code></div>
29-
<img style="width: 90%" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg"/>
30-
<img style="width: 500px; max-width: 90%" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg"/>
29+
<img style="width: 90%" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg"/>
30+
<img style="width: 500px; max-width: 90%" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg"/>
3131
<p style="margin: 0 200px">
32-
<img style="width: 500px; max-width: 90%" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg"/>
32+
<img style="width: 500px; max-width: 90%" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg"/>
3333
</p>
3434
</div>
3535
</body>

Source/Demo/Common/TestSamples/19.Many images.htm

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,102 +2,102 @@
22
<body>
33
<h2>Contains many images that should not load until in scroll view</h2>
44
<h3>Image</h3>
5-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
5+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
66
<h3>Another image</h3>
7-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
7+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
88
<h3>Another image</h3>
9-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
9+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
1010
<h3>Another image</h3>
11-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
11+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
1212
<h3>Another image</h3>
13-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
13+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
1414
<h3>Another image</h3>
15-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
15+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
1616
<h3>Another image</h3>
17-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
17+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
1818
<h3>Another image</h3>
19-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
19+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
2020
<h3>Another image</h3>
21-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
21+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
2222
<h3>Another image</h3>
23-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
23+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
2424
<h3>Another image</h3>
25-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
25+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
2626
<h3>Another image</h3>
27-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
27+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
2828
<h3>Another image</h3>
29-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
29+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
3030
<h3>Another image</h3>
31-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
31+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
3232
<h3>Another image</h3>
33-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
33+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
3434
<h3>Another image</h3>
35-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
35+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
3636
<h3>Another image</h3>
37-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
37+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
3838
<h3>Another image</h3>
39-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
39+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
4040
<h3>Another image</h3>
41-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
41+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
4242
<h3>Another image</h3>
43-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
43+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
4444
<h3>Another image</h3>
45-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
45+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
4646
<h3>Another image</h3>
47-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
47+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
4848
<h3>Another image</h3>
49-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
49+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
5050
<h3>Another image</h3>
51-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
51+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
5252
<h3>Another image</h3>
53-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
53+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
5454
<h3>Another image</h3>
55-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
55+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
5656
<h3>Another image</h3>
57-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
57+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
5858
<h3>Another image</h3>
59-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
59+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
6060
<h3>Another image</h3>
61-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
61+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
6262
<h3>Another image</h3>
63-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
63+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
6464
<h3>Another image</h3>
65-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
65+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
6666
<h3>Another image</h3>
67-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
67+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
6868
<h3>Another image</h3>
69-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
69+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
7070
<h3>Another image</h3>
71-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
71+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
7272
<h3>Another image</h3>
73-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
73+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
7474
<h3>Another image</h3>
75-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
75+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
7676
<h3>Another image</h3>
77-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
77+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
7878
<h3>Another image</h3>
79-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
79+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
8080
<h3>Another image</h3>
81-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
81+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
8282
<h3>Another image</h3>
83-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
83+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
8484
<h3>Another image</h3>
85-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
85+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
8686
<h3>Another image</h3>
87-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
87+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
8888
<h3>Another image</h3>
89-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
89+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
9090
<h3>Another image</h3>
91-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
91+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
9292
<h3>Another image</h3>
93-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
93+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
9494
<h3>Another image</h3>
95-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
95+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
9696
<h3>Another image</h3>
97-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
97+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
9898
<h3>Another image</h3>
99-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
99+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
100100
<h3>Another image</h3>
101-
<img width="500" src="http://www.canadianpetconnection.com/wp-content/uploads/2011/09/Cats1.jpg" />
101+
<img width="500" src="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg" />
102102
</body>
103103
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net7.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\..\..\HtmlRenderer.Core\HtmlRenderer.Core.csproj" />
12+
<ProjectReference Include="..\..\..\HtmlRenderer.PdfSharp.Core\HtmlRenderer.PdfSharp.Core.csproj" />
13+
<ProjectReference Include="..\..\..\HtmlRenderer.SkiaSharp\HtmlRenderer.SkiaSharp.csproj" />
14+
<ProjectReference Include="..\..\Common\HtmlRenderer.Demo.Common.csproj" />
15+
</ItemGroup>
16+
17+
</Project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using TheArtOfDev.HtmlRenderer.Demo.Common;
7+
using TheArtOfDev.HtmlRenderer.PdfSharp;
8+
9+
namespace HtmlRenderer.Demo.Console
10+
{
11+
public class PdfSharpCoreConverter : SampleConverterBase
12+
{
13+
public PdfSharpCoreConverter(string sampleRunIdentifier, string basePath) : base(sampleRunIdentifier, basePath)
14+
{
15+
}
16+
17+
public void GenerateSample(HtmlSample sample)
18+
{
19+
var config = new PdfGenerateConfig();
20+
21+
config.PageSize = PdfSharpCore.PageSize.A4;
22+
config.MarginLeft = 0;
23+
config.MarginRight = 0;
24+
config.MarginTop = 0;
25+
config.MarginBottom = 0;
26+
27+
var pdf = PdfGenerator.GeneratePdf(sample.Html, config, base.CssData, base.StylesheetLoad, base.ImageLoad);
28+
pdf.Save(GetSamplePath(sample));
29+
}
30+
}
31+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using HtmlRenderer.Demo.Console;
2+
using System.Diagnostics;
3+
using TheArtOfDev.HtmlRenderer.Demo.Common;
4+
5+
//By default, write to a sub folder 'output'
6+
string basePath= @".\Ouput";
7+
if (args.Length > 0)
8+
{
9+
//And if there's an output path given, use that.
10+
basePath = args[0];
11+
}
12+
13+
//Probably won't be running a suite of tests more than once a second, so this will do.
14+
string runIdentifier = DateTime.Now.ToString("ddMMyyyy-hhMMss");
15+
16+
var skia = new SkiaConverter(runIdentifier, basePath);
17+
var pdfSharp = new PdfSharpCoreConverter(runIdentifier, basePath);
18+
19+
SamplesLoader.Init("Console", typeof(Program).Assembly.GetName().Version.ToString());
20+
21+
var samples = SamplesLoader.TestSamples;
22+
23+
foreach (var htmlSample in samples)
24+
{
25+
skia.GenerateSample(htmlSample);
26+
pdfSharp.GenerateSample(htmlSample);
27+
}
28+
29+
30+
//At this point.. there should be something!!
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"HtmlRenderer.Demo.Console": {
4+
"commandName": "Project",
5+
"commandLineArgs": "..\\..\\..\\Output"
6+
}
7+
}
8+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Runtime.CompilerServices;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using TheArtOfDev.HtmlRenderer.Demo.Common;
8+
9+
namespace HtmlRenderer.Demo.Console
10+
{
11+
public class SampleConverterBase
12+
{
13+
private string _sampleRunIdentifier;
14+
private string _thisTypeName;
15+
private string _basePath;
16+
17+
public SampleConverterBase(string sampleRunIdentifier, string basePath)
18+
{
19+
_sampleRunIdentifier = sampleRunIdentifier;
20+
_basePath = basePath;
21+
_thisTypeName = this.GetType().Name;
22+
}
23+
24+
protected string GetSamplePath(HtmlSample sample)
25+
{
26+
var path = Path.Combine(_basePath, _sampleRunIdentifier);
27+
Directory.CreateDirectory(path);
28+
return Path.Combine(path, sample.FullName + _thisTypeName + "_" + ".pdf");
29+
}
30+
}
31+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using TheArtOfDev.HtmlRenderer.Demo.Common;
7+
using TheArtOfDev.HtmlRenderer.SkiaSharp;
8+
9+
namespace HtmlRenderer.Demo.Console
10+
{
11+
public class SkiaConverter : SampleConverterBase
12+
{
13+
public SkiaConverter(string sampleRunIdentifier, string basePath) : base(sampleRunIdentifier, basePath)
14+
{
15+
}
16+
17+
public void GenerateSample(HtmlSample sample)
18+
{
19+
var config = new PdfGenerateConfig();
20+
21+
config.PageSize = PageSizeType.A4;
22+
//TODO: 'Units' on config, rather than this c/p 🤮
23+
config.MarginLeft = PdfGenerateConfig.MilimitersToPixels(0);
24+
config.MarginRight = PdfGenerateConfig.MilimitersToPixels(0);
25+
config.MarginTop = PdfGenerateConfig.MilimitersToPixels(0);
26+
config.MarginBottom = PdfGenerateConfig.MilimitersToPixels(0);
27+
28+
var pdf = PdfGenerator.GeneratePdf(sample.Html, config, base.CssData, base.StylesheetLoad, base.ImageLoad);
29+
using (var fileStream = File.Open(GetSamplePath(sample), FileMode.CreateNew))
30+
{
31+
pdf.CopyTo(fileStream);
32+
fileStream.Flush();
33+
}
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)