Skip to content

Commit 499e0ff

Browse files
committed
Updated to 2022.6.1
1 parent a3eaf68 commit 499e0ff

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

Program.cs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Runtime.InteropServices;
55
using QuestPDF.Fluent;
6+
using QuestPDF.Previewer;
67

78
namespace QuestPDF.ExampleInvoice
89
{
@@ -14,21 +15,32 @@ class Program
1415
/// </summary>
1516
static void Main(string[] args)
1617
{
17-
var filePath = "invoice.pdf";
18-
1918
var model = InvoiceDocumentDataSource.GetInvoiceDetails();
2019
var document = new InvoiceDocument(model);
20+
21+
// Generate PDF file and show it in the default viewer
22+
//GenerateDocumentAndShow(document);
23+
24+
// Or open the QuestPDF Previewer and experiment with the document's design
25+
// in real-time without recompilation after each code change
26+
document.ShowInPreviewer();
27+
}
28+
29+
static void GenerateDocumentAndShow(InvoiceDocument document)
30+
{
31+
const string filePath = "invoice.pdf";
32+
2133
document.GeneratePdf(filePath);
2234

23-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
35+
var process = new Process
2436
{
25-
Process.Start("explorer.exe", filePath);
26-
}
27-
else
28-
{
29-
var fullPath = Path.Combine(Directory.GetCurrentDirectory(), filePath);
30-
Console.WriteLine($"Output PDF file is available here: {fullPath}");
31-
}
37+
StartInfo = new ProcessStartInfo(filePath)
38+
{
39+
UseShellExecute = true
40+
}
41+
};
42+
43+
process.Start();
3244
}
3345
}
3446
}

QuestPDF.ExampleInvoice.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="QuestPDF" Version="2022.4.1" />
10+
<PackageReference Include="QuestPDF" Version="2022.6.1" />
1111
</ItemGroup>
1212

1313
</Project>

0 commit comments

Comments
 (0)