I would like to insert a pdf document – as an object - into a word document. How can I do it?
Thanks for your inquiry. Yes, you can insert word/pdf/excel files in word document at any place. First you need to move the cursor to the desired position in document where you want to insert OLE object at. Once the cursor is moved, please use the following code for example to insert Pdf document from file as a normal OLE object using custom presentation image. In this case, when you double click on the OLE object, it will open linked document in a new Pdf window:
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); Image image = Image.FromFile(MyDir + "Aspose.Words.jpg"); Shape oleObject = builder.InsertOleObject(MyDir + "16.11.0.pdf", "Acrobat.Document.DC", false, false, image); doc.Save(MyDir + @"out.docx");
I hope, this helps.
Thank you! it works!