0

I have to attach a pdf file in a pptx slide during runtime.

Tried the following:

Attached a pdf file in the pptx slide (Insert -> Object -> Adobe Acrobat Document). Accessed the oleobject using the following code :

OleObjectBinaryPart oleObjectBinaryPart = new OleObjectBinaryPart(new PartName("/ppt/embeddings/oleObject1.bin"));

Updating the oleObjectBinaryPart using the following code:

oleObjectBinaryPart.setBinaryData(reportBlob.getBinaryStream());

Updating the pptx with the new oleobject:

pptMlPackage.getParts().getParts().put(new PartName("/ppt/embeddings/oleObject1.bin"), oleObjectBinaryPart);
pptMlPackage.save(new File("C:/test_report/pptx_out.pptx"));

After executing this code the pptx_out.pptx file got generated without any errors. But while trying to open the embedded pdf in powerpoint 2010 I'm getting following error:

The server application, source file, or item can't be found, or returned an unknown error. You may need to reinstall the sever application.

Is it a problem with the oleobject when updating?

1 Answers1

0

You can't just attach the PDF as a binary blob; it has to be in the correct OLE format.

See further this discussion.

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84