Background:
I am the developer of IguanaTex, a PowerPoint add-in to insert LaTeX displays/equations into PowerPoint on Windows and Mac.
Many Mac users use another software, LatexIt, to insert PDF generated from LaTeX into PowerPoint (and other applications); the PDF stores the LaTeX source as metadata in a rather complex way, and this metadata is still accessible in the EMF file that PowerPoint uses internally to store the PDF (which can be obtained by unzipping the .pptx file). It is also preserved in a PDF created by using "Save picture as PDF" on the Mac.
I would like to allow IguanaTex users on Windows to retrieve that LaTeX information so that they can modify slides created by LatexIt users on the Mac.
Issue:
I thought I could extract the internal EMF corresponding to the inserted PDF using "Save picture as .emf", and parse it. LatexIt's developer kindly prepared a Windows executable that can retrieve that information from an EMF file such as the one stored internally by PowerPoint.
Unfortunately, I realized that using "Save picture as .emf" on Windows to get an EMF file from the picture obtained by inserting a PDF on Mac did not lead to the same EMF file that PowerPoint uses internally, and the LatexIt metadata is lost in the process.
I am pessimistic, but does anyone see a way around this? Either to get access to the internal EMF file somehow, or save as EMF using some other procedure?
To clarify the situation: I have an open .pptx file on Windows potentially with dozens of pictures/shapes/etc in it, one selected shape in that file which I know is internally an EMF picture; how can I extract that EMF file using VBA?
Here is code to extract the file in the presentation's internal storage corresponding to a selected picture Shape (
msoPicture, here of type EMF, but it can be any supported type: JPG, PNG, GIF, ...):To run
unzip, the above code uses the Shell execution code as implemented in IguanaTex (remove the ClipBoard call, which is unnecessary here and comes from another module), largely borrowed from Terry Kreft's "Shell and Wait" .The code can be easily modified to extract any media file by changing the filter used in the unzip command to
"ppt\media\*.*", but then the cleanup to move files from down the folder tree becomes a bit more tedious.