We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Insert Preview into word

Hello!!!

Is there a way to insert a preview of a PDF file into a Word Document??

Thanks!
Hi Ubaldo,

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);
Shape oleObject = builder.insertOleObject("D:\\temp\\Some.pdf", "Acrobat.Document.DC", false, false, null);
doc.save("D:\\temp\\awjava-16.12.0.docx");

I hope, this helps.

Best regards,
Hello!
I tried with the example that you gave me, but i didnt get the preview of the PDF file, I took a screenshot of what I got with the example that you gave me and a screenshot of what Im looking for

Hi Ubaldo,


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Sample PDF file
  • Aspose.Words generated output DOCX file showing the undesired behavior
  • Please attach your expected document (DOCX) showing the required output here for our reference. We will investigate the structure of your expected document as to how you want your final output be generated like. You can create expected document using Microsoft Word.
  • Screenshot(s)

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

Hello!


I´m sending the a PDF file, the Original Document, the Document created with Aspose.Words for Java, and a Screenshot of the document.

The Original Document was coded with Delphi, but we are trying to upgraded with Java.

Thanks for your support.

Hi Ubaldo,


I think, you can first Convert Pdf Page to Image by using Aspose.Pdf for Java and then pass this image to DocumentBuilder.insertOleObject method.

Best regards,
Thanks!

Now I will try this solution, as soon as I have news I will contact you, thank you very much for your attention.
Regards.

what will it be if i have to preview an excel which is added as on ole.
for now i see and excel icon and once i double click that i can see data.

Hi,


Please follow your other thread for further proceedings.

Best regards,