I'm working on an application in asp.net / C# 3.5 / Winforms.
This application is rendering a PDF file and a Word file.
We use Microsoft.Office.Interop.Word for word and sharpPDF for PDF.
Our client ask us to put the same thing that is in the PDF into the Word document.
How can I do such a thing easily whithout touch the existing code ?
Here is the kind of code I want to do
pdfDocument myPdf = new pdfDocument("Title", "Title");
// fill pdf
Microsoft.Office.Interop.Word.Application msWord = new Microsoft.Office.Interop.Word.Application();
// fill word
msWord.Bookmarks.get_Item(ref oBookMarkId).Range = myPdf ;
Edit : An idea could be
Any idea about how to convert PDF into Image ?
Edit2 : I have find this function AddOLEObject
How can I linked my PDF which is in memory to that function ?
Find the solution with AddOLEObject and creating a temporary pdf file :
string tempNameFilePdf = "C:\\temp\\temp" + DateTime.Now.Ticks + ".pdf";
pdfDocument pdfDocument = getPdf();
pdfDocument.createPDF(tempNameFilePdf);
object oBookMarkId = "Schema";
object missing = System.Reflection.Missing.Value;
object fileNameObject = tempNameFilePdf;
object classType = "AcroRd32.Document";
object oFalse = false;
wordDocument.Bookmarks.get_Item(ref oBookMarkId).Range.InlineShapes.AddOLEObject(
ref classType, ref fileNameObject, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);