私は c#、wpf、および pdfsharp ライブラリが初めてです。これは私の XAML コードです:
<Grid>
<zoom:ZoomControl>
<graphsharp:GraphLayout x:Name="graphLayout"
Graph="{Binding ElementName=root, Path=GraphToVisualize}"
LayoutAlgorithmType="FR"
OverlapRemovalAlgorithmType="FSA"
HighlightAlgorithmType="Simple"></graphsharp:GraphLayout>
</zoom:ZoomControl>
<Button Content="Button" Height="23" Name="button1" Width="75" Margin="12,294,658,412" Click="button1_Click" />
</Grid>
Pdfsharpを使用して、「graphLayout」をpdfファイルに保存したいと思います。ボタンを作成し、基本的には pdfsharp wiki の「hello world」サンプル コードを使用して開始しました。
PdfDocument document = new PdfDocument();
document.Info.Title = "Created with PDFsharp";
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
gfx.DrawString("My Graph", font, XBrushes.Black,
new XRect(0, 0, page.Width, page.Height),
XStringFormats.TopCenter);
const string filename = "MyGraph.pdf";
document.Save(graphLayout+filename);
Process.Start(filename);
私は pdf を取得しますが、そこにはテキストだけがあります。レイアウト全体をPDFに保存する方法を教えてください。ありがとう