Adding an embedded PDF file / OLE container header question

I’ve been struggling along with trying to insert a PDF file into the PPT for some time (in any form, embedded icon and click through to Acrobat is fine) and it’s now become a critical issue for us, so I decided to investigate more thoroughly…

It seems that if I load a presentation containing a manually embedded PDF file, I can locate the OleObjectFrame, call getObjectData() on it and create a new presentation containing the same PDF by using that byte array. All works fine.

So, this lead me to wonder why I couldn’t add my own PDF files to a presentation when Word, Excel and pictures all work fine. So, I tried dumping out the byte array to disk and comparing it to the PDF that had been embedded.

To me, it looks like the byte array has some kind of OLE header that’s 4k long (including a copy of the objectName, objectClassName etc) and some padding at the end (to make it’s length a multiple of 256/512/1024/2048/4096?)

Is this OLE header something that Aspose PPT already processes? Shouldn’t setObjectData automatically wrap a bytestream in the appropriate header? Do you have any links that describe the format of this header?

I also found this link which suggests that it might be an internal-to-powerpoint object serialisation header:
http://groundside.com/blog/DuncanMills.php?m=200408

I have just tested presentation with embedded pdf document.
Looks like there are 2 ways MS PowerPoint store embedded documents.
1. Directly in the OLE object (gzipped). This method used for ms office documents.
2. Inside additional container. That is used for PDF documents (and probably for any other non ms files).

This additional container is just standard OLE binary format with several streams inside.
One of the streams is PDF file. So in theory we can implement reading such files in very short time.
But writing PDF and generating new containers will take more time of course.

I have managed to make a work around for PDF file insertion by using the POIFS library to generate an embedded OLE filesystem. It would be nice if this support could be incorporated into a later release of Aspose.

It seems that the hex version of the class ID is critical to this working, so the current interface would need extending to support this.

Can you share this POIFS code that you are using to wrap the PDF in an OLE container. I'm trying the same work around to embed a PDF file into a powerpoint.

-SH