Skip to content

Commit 30a3364

Browse files
931474: Fit To Width Sample
1 parent e08833d commit 30a3364

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

How to/FitToWidth/ConsoleApp1.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35527.113 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{974A1524-7916-4A6D-A66D-C71F56A751F8}"
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+
{974A1524-7916-4A6D-A66D-C71F56A751F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{974A1524-7916-4A6D-A66D-C71F56A751F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{974A1524-7916-4A6D-A66D-C71F56A751F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{974A1524-7916-4A6D-A66D-C71F56A751F8}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="29.1.33" />
12+
</ItemGroup>
13+
14+
</Project>
1.43 KB
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Syncfusion.Pdf;
2+
using Syncfusion.Pdf.Graphics;
3+
using System.IO;
4+
5+
class Program
6+
{
7+
static void Main()
8+
{
9+
// Create a new PDF document
10+
PdfDocument doc = new PdfDocument();
11+
12+
// Add a new page to the document
13+
PdfPage page = doc.Pages.Add();
14+
15+
// Set the document’s viewer preferences
16+
doc.ViewerPreferences.FitWindow = true; // Fit the document to the window
17+
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage; // Display one page at a time
18+
19+
// Save and close the document
20+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
21+
{
22+
doc.Save(outputFileStream); // Save the document to a file
23+
}
24+
25+
// Close the document after saving
26+
doc.Close(true);
27+
}
28+
}

0 commit comments

Comments
 (0)