I have a problem concerning integrating both Migradoc and SharpPDF.
I am creating a pdfpage with text with the pdfpage.add(text) function. (SharpPDF) However I also am creating a chart from data using the functionality of MigraDoc.
So my PDF code (SharpPDF) is as follows:
pdfDocument myDoc = new pdfDocument("Test", "Test", false);
pdfPage pdfpage = myDoc.addPage();
pdfpage.addText("Bladiebla");
pdfpage.addText("Some more Bladiebla");
myDoc.createPDF(FilePath);
My chart code (MigraDoc) is as follows:
Document document = new Document();
document = startDocument(document, "Chart");
//Create chart functions
document.LastSection.Add(chart);
Is there any way or function that I can use to insert the chart into the PDF before I call the createPDF function? (Maybe convert the chart to image and insert perform pdfpage.addImage();?)
What I have tried thus far is:
PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
renderer.Document = document;
renderer.RenderDocument();
pdfPage page2 = myDoc.addPage();
page2 = renderer.PdfDocument.Pages[0];
This give's the following error: Cannot implicity convert type PdfSharp.Pdf.PdfPage to SharpPdf.PdfPage