Skip to content

Commit 2dc114a

Browse files
authored
Merge pull request #39 from SyncfusionExamples/PdfToImageSample
playground sample
2 parents 5c6b537 + dd17167 commit 2dc114a

File tree

5 files changed

+78
-0
lines changed

5 files changed

+78
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.35122.118
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFPage-to-Image", "PDFPage-to-Image\PDFPage-to-Image.csproj", "{6016BC9A-43D0-4255-8302-84BC6EB16A29}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{6016BC9A-43D0-4255-8302-84BC6EB16A29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{6016BC9A-43D0-4255-8302-84BC6EB16A29}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{6016BC9A-43D0-4255-8302-84BC6EB16A29}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{6016BC9A-43D0-4255-8302-84BC6EB16A29}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {67049C12-8F85-4D77-BA02-F802BA909F47}
24+
EndGlobalSection
25+
EndGlobal
Binary file not shown.

PDF-to-image/.NET/PDFPage-to-Image/PDFPage-to-Image/Output/.gitkeep

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>PDFPage_to_Image</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.PdfToImageConverter.Net" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\Input.pdf">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\.gitkeep">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Syncfusion.PdfToImageConverter;
2+
using System.IO;
3+
4+
5+
namespace NET
6+
{
7+
class Programe
8+
{
9+
public static void Main(string[] args)
10+
{
11+
//Initialize PDF to Image converter.
12+
PdfToImageConverter imageConverter = new PdfToImageConverter();
13+
14+
//Load the PDF document as a stream
15+
FileStream inputStream = new FileStream("../../../Data/Input.pdf", FileMode.Open, FileAccess.ReadWrite);
16+
imageConverter.Load(inputStream);
17+
18+
//Convert PDF to Image.
19+
Stream outputStream = imageConverter.Convert(0, false, false);
20+
21+
//Create file stream.
22+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Output.jpeg"), FileMode.Create, FileAccess.ReadWrite))
23+
{
24+
//Save the image to file stream.
25+
inputStream.CopyTo(outputFileStream);
26+
}
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)