What settings are there in PdfExportOptions when it doesn't work? I got the attached PDF file with following code:
private void button1_Click(object sender, EventArgs e)
{
saveFileDialog.DefaultExt = "pdf";
saveFileDialog.Filter = "PDF files|*.pdf";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
var pdfExporter = new MindFusion.Diagramming.Export.PdfExporter
{
AutoScale = MindFusion.Diagramming.Export.AutoScale.FitToWidth,
InvisibleItems = true,
Margins = new Margins(10, 10, 10, 10),
PageOrientation = PageOrientation.Landscape,
PageSize = PageSize.A4,
Scale = 100,
};
pdfExporter.Export(diagramView1.Diagram, saveFileDialog.FileName);
}
}
private void diagram_DrawForeground(object sender, DiagramEventArgs e)
{
var graphics = e.Graphics as PdfGraphics;
if (graphics != null)
{
var pageContentRect = e.ClipRect;
var font = new Font("Arial", 10);
graphics.DrawString(
"header", font, Brushes.Black, pageContentRect,
new StringFormat
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Near
});
graphics.DrawString(
"footer", font, Brushes.Black, pageContentRect,
new StringFormat
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Far
});
font.Dispose();
}
}
If you set a breakpoint inside DrawForeground handler, does the debugger ever stop there when you export?