-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hi, I want combine both sample for preview the mix pdf
https://github.com/empira/MigraDoc-samples/tree/master/samples/wpf/MixMigraDocAndPdfSharp
https://github.com/empira/MigraDoc-samples/tree/master/samples/wpf/DocumentViewer
But when preview, it only show data from Migradoc
Here is my code:
PdfDocument pdfDocument = new PdfDocument();
PdfPage page = pdfDocument.AddPage();
page.Size = PdfSharp.PageSize.A4;
page.Orientation = PdfSharp.PageOrientation.Landscape;
XGraphics gfx = XGraphics.FromPdfPage(page);
XFont fontH1 = new XFont("Arial", 18, XFontStyle.Bold);
XFont font = new XFont("Arial", 12);
XFont fontItalic = new XFont("Arial", 12, XFontStyle.BoldItalic);
double ls = font.GetHeight();
// Draw some text
gfx.DrawString("Create PDF on the fly with PDFsharp",
fontH1, XBrushes.Black, x, x);
Document doc = new Document();
var sec = doc.AddSection();
sec.PageSetup.Orientation = Orientation.Landscape;
sec.PageSetup.PageFormat = PageFormat.A4;
var para = sec.AddParagraph();
para.Format.Alignment = ParagraphAlignment.Justify;
para.Format.Borders.Color = Colors.AliceBlue;
para.AddText("Migradoc");
var docRenderer = new DocumentRenderer(doc);
docRenderer.PrepareDocument();
docRenderer.RenderObject(gfx, XUnit.FromCentimeter(5), XUnit.FromCentimeter(10), "12cm", para);
var ddl = DdlWriter.WriteToString(doc);
Preview.Ddl = ddl