forked from GowenGit/docnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageToPdfExamples.cs
36 lines (31 loc) · 908 Bytes
/
ImageToPdfExamples.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.IO;
using Docnet.Core.Editors;
using Xunit;
namespace NugetUsageAnyCpu
{
[Collection("Example collection")]
public class ImageToPdfExamples
{
private readonly ExampleFixture _fixture;
public ImageToPdfExamples(ExampleFixture fixture)
{
_fixture = fixture;
}
/// <summary>
/// Given file path to a JPEG and width, height,
/// create a PDF file for it.
/// </summary>
[Fact]
public void JpegToPdf_WhenCalledWithJpeg_ShouldSucceed()
{
var file = new JpegImage
{
Bytes = File.ReadAllBytes("Assets/image_0.jpeg"),
Width = 1024,
Height = 1024
};
var bytes = _fixture.DocNet.JpegToPdf(new[] { file });
File.WriteAllBytes("../../../output_file.pdf", bytes);
}
}
}