Problem with extracting embedded PDF from PPT

byte[] oleData = ole.ObjectData;

using (BinaryWriter writer = new BinaryWriter(File.Open(extractFullPath, FileMode.Create)))

{

writer.Write(oleData)

}

Using the above code, I am able to extract embedded ole objects for other types other than if a Pdf document is embedded in the powerpoint. The extracted pdf file would always be corrupted, although you can open the pdf file inside the ppt fine.

I can send you the an example, but this behavior seems to be very consistant for every pdf extraction from ppt I have tried.

Can you help me with this issue? Thanks!

Dear becky_bai,

Thank you for using Aspose.Slides.

I have seen this problem and will report it. It will be fixed as soon as possible.

Take care.

Dear becky_bai,

Aspose.Slides only extracts MS Office documents from OLE Objects. All other documents are stored in additional container application inside PowerPoint.

Is there a way that I can extract Pdf properly using Aspose.Slides? Thanks!

Or I guess my question was: are you still looking to make pdf “extractable”?

Dear becky_bai,

We are doing an enhancement in the Aspose.Slides after which you will be able to extract PDF documents from OLE object frame. The new release of Aspose.Slides with this enhancement will be available soon probably within two three days.

That is great! Thank you!

Dear becky,

Aspose.Slides 2.6.11.0 with new enhancement of extracting PDF document has been released. You can download it from here.

I have downloaded version 2.6.12.0, I still can't seem to correctly extract pdf. Is there anything special I need to do for these non-MS office object, other than my code in my first post?

Thank you!

Dear becky_bai,

Please try Aspose.Slides 2.6.11.0 . I have tested my code on it and it works fine there. I will also test it on newer version to check whether if something is broken again while fixing the last issue. Here is my code.

void ExtractPDF()
{
    Presentation srcPres = new Presentation("srcPDF.ppt");
    Slide fstSlide = srcPres.GetSlideByPosition(1);
    OleObjectFrame oleObjFrm = fstSlide.FindShape("PDFObject") as OleObjectFrame;
    FileStream fout = new FileStream("c:\\PDFDoc.pdf", FileMode.Create, FileAccess.Write);
    fout.Write(oleObjFrm.ObjectData, 0, oleObjFrm.ObjectData.Length);
    fout.Flush();
    fout.Close();
}

Dear becky_bai,

I don’t find anything wrong in your code and it works perfectly well on latest release of Aspose.Slides 2.6.12.0

I have attached the source presentation and output pdf document for you to view/use them.

void ExtractPDF()
{
    Presentation srcPres = new Presentation("srcPDF.ppt");
    Slide fstSlide = srcPres.GetSlideByPosition(1);
    OleObjectFrame oleObjFrm = fstSlide.FindShape("PDFObject") as OleObjectFrame;

    using (BinaryWriter writer = new BinaryWriter(File.Open("c:\\OutputPDF.pdf", FileMode.Create)))
    {
        writer.Write(oleObjFrm.ObjectData);
    }
}

Thanks.

I couldn't find the download for 2.6.11.0, it seem to be deleted. If you get a chance to try the code on 2.6.12.0, please let me know the result.

Appreciate your help!

Dear becky_bai,

I have already tested it on Aspose.Slides 2.6.12.0. Please see my above post.

I tried to extract pdf from the example ppt you send, it works. But it doesn’t work for any ppt I created. I want to send you an example, is there a way I can do attachment?

Dear becky_bai,

You can send me your file by attaching it with this post. Follow these steps

[Reply] – > [Options] – > [Add/Update]

Do not use [Quick Reply] button, user [Reply] button.

Please see the attached example. Thanks for your help!

Sorry, here is the attachment. The pdf file is what I extracted using Aspose.Slides. The ppt file is the containing file. Thanks!

Dear becky,

I have seen this problem, but to investigate it further, I need the stand alone PDF document, which is embedded inside the PowerPoint Presentation.

I have attached the pdf. Thanks for looking into the issue.

Dear becky_bai,

Thank you for submitting the PDF document. You need to download the latest version of Aspose.Slides 2.6.13.0 from here. There is no such problem with it and everything seems to be fine, please check it.