Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Embed Document into Word Document as OLE Object using Java
// Embed PDF into a Word Document as an OLE object
int pageNumber = 1;
OleWordProcessingOptions oleWordsOptions = new OleWordProcessingOptions("PDF-document.pdf", pageNumber);
oleWordsOptions.setWidth(200); // Setting the width and height of embedded document
oleWordsOptions.setHeight(200);
// Import the PDF into Word Document
Merger merger = new Merger("document.docx"); // Source Word document
merger.importDocument(oleWordsOptions);
merger.save("output-document.docx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.