Get PDF file from PPT File

J

justjunktome

Hi,
I am developing an C#.net application to extract embedded object from
Office Files(DOC,XLS,PPT)
I am having problem extracting PDF files from PPT file.
My PPT file has PDF file attached to it. I am doing like this:

foreach (PPT.Slide slide in presentation.Slides)
{
foreach (PPT.Shape shape in slide.Shapes)
{

Microsoft.Office.Interop.PowerPoint.OLEFormat format =
shape.OLEFormat;
string progId = format.ProgID;
if(progId.StartsWith("Word.Document"))
{
//Deal with DOC file inside.
}
else if
(progId.StartsWith("AcroExch.Document"))
{
//Which OLEObject should i use
here. ?
//I dont know how to save this
oleobject...?

format.OLEObject

}

}
}
All i want is to save the PDF file somewhere in the disk so that i can
deal with it later.
Any tips or pseudo code will be greatly appreciated.

Thank You
miztaken
 
J

justjunktome

Hi there,
Thanks for the reply.
oledata.mso file seems little messy and would cause more disk
operations.
I want to minimize the whole process.
Can you point me to any thread or pseudo code that demonstrates reader
automation to open and save PDF file.
My problem is i am unable to get object from OLEObject type.
How can i attach the object i cant get ?

Please help me
miztaken
 
J

justjunktome

Hi there,
Now i am able to activate the whole thing.
ie.
Microsoft.Office.Interop.PowerPoint.OLEFormat format =
shape.OLEFormat;
format.Activate();

But after that when i try to fetch the object i.e. format.Object then
it throws exception.

Specified cast is not valid.
Stack Trace
at Microsoft.Office.Interop.PowerPoint.OLEFormat.get_Object()


Please help me on this one.:-(

If in anyway i can copy the object to clipboard then i hope i can get
it in MemoryStream and then dump to a File :)

Thank You
 
J

justjunktome

Hi Steve,
I agree with your statement but the thing i was curious about is:
why cant we extract PDF Object inside PPT.
I mean its there and we can open it when we double-click it.
But why cant we access it pro grammatically.

In other cases (when DOC or XLS) are embedded inside PPT file then
format.Object returns OLEObject but when PDF is embedded it returns
nothing or only error that i mentioned in my previous post.

Does this all mean its impossible to get PDF object from PPT ?
What happens if we drag ZIP or RAR or any other compressed file to the
PPT?


Thank You
 
J

justjunktome

Hi Steve,
Can you give me some info about how to access oledata.mso file and get
the attachments from it.
I have search the whole internet and found nothing.

Can you help me?

Thank You
miztaken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top