Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active October 10, 2020 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/313e9882bedaa1e65c5a540d4f30c8b0 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/313e9882bedaa1e65c5a540d4f30c8b0 to your computer and use it in GitHub Desktop.
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