Skip to content

Commit

Permalink
Merge pull request #14 from swagfin/feature/multi-page-generating
Browse files Browse the repository at this point in the history
Feature/multi page generating
  • Loading branch information
swagfin committed Jun 24, 2023
2 parents cc0e6f5 + 179016c commit 60dd676
Show file tree
Hide file tree
Showing 17 changed files with 879 additions and 37 deletions.
15 changes: 7 additions & 8 deletions SemanticXamlPrint.DemoNetCore/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using PdfSharpCore.Drawing;
using PdfSharpCore.Pdf;
using PdfSharpCore.Pdf;
using SemanticXamlPrint.Parser;
using SemanticXamlPrint.Parser.Components;
using SemanticXamlPrint.PDF.NetCore;
using System;
using System.IO;

namespace SemanticXamlPrint.DemoNetCore
{
internal class Program
Expand All @@ -17,22 +17,21 @@ static void Main(string[] args)
try
{
//Get Template Contents
byte[] xamlFileBytes = File.ReadAllBytes("custom.grid.template");
byte[] xamlFileBytes = File.ReadAllBytes("custom.excessgrid.template");
//Use Default Parser
IXamlComponent xamlComponent = DefaultXamlParser.Parse(xamlFileBytes);

//#### PDF SHARP #####
using (PdfDocument document = new PdfDocument())
{
// Add a page to the document
PdfPage page = document.AddPage();
// Create a graphics object for the page
XGraphics xgraphics = XGraphics.FromPdfPage(page);
//Use Xaml Draw Extension to Generate PDF
xgraphics.DrawXamlComponent(xamlComponent);
document.DrawXamlComponent(xamlComponent);
// Save the PDF document to a file
document.Save("outputcore.pdf");
}
//#### PDF SHARP #####


}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
</PropertyGroup>

<ItemGroup>
<None Remove="custom.excessgrid.template" />
<None Remove="custom.grid.template" />
</ItemGroup>

<ItemGroup>
<Content Include="custom.excessgrid.template">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="custom.grid.template">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
Loading

0 comments on commit 60dd676

Please sign in to comment.