Hello, Thomas. Thank you for answer. Do you have any ideas, how can I debug this to understand the problem?
I created the test project (Clear WPF .NET 4.8 App ), and add PdfSharp via NuGet. I got the same result in this blank project - I can see only line, but no text
Here is the full code:
Code:
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PDFSharpTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
PdfDocument document = new PdfDocument();
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
XGraphicsPath path = new XGraphicsPath();
// Test gfx active
gfx.DrawLine(XPens.Black, 10, 10, 100, 100);
// Output outlined font
path.AddString("Hello!", new XFontFamily("Times New Roman"), XFontStyle.BoldItalic, 100, new XRect(0, 0, 250, 140), XStringFormats.Center);
gfx.DrawPath(new XPen(XColors.Purple, 2.3), XBrushes.DarkOrchid, path);
const string filename = "HelloWorld.pdf";
document.Save(filename);
Process.Start(filename);
}
}
}