Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Thu Jun 24, 2021 12:07 pm

Hello,

I have an issue about progid. I am creating a ppt file without problem. I can access an excel oleobject, word oleobject but i cant access pdf file because i don't know valid progid for pdf files?

can you help me?

Code: Select all

                            fileName = "pdffile.png";
                            Spire.Presentation.IOleObject oleObject = presentation.Slides[c + 2].Shapes.AppendOleObject("", fromArray, rec);
                            oleObject.IsIconVisible = true;
                            oleObject.ProgId = "acrobat"; //???
                            Image img = Image.FromFile(fileName);
                            Spire.Presentation.Drawing.IImageData oleImage = presentation.Images.Append(img);

                            oleObject.SubstituteImagePictureFillFormat.Picture.EmbedImage = oleImage;

afciftler
 
Posts: 2
Joined: Thu Jun 24, 2021 11:22 am

Fri Jun 25, 2021 3:21 am

Hello,

Thanks for your inquiry.
The “oleObject.ProgId” is related to the PDF document reader installed on your system. You can refer to the following code to meet your requirement.

Code: Select all
            //oleObject.ProgId = "package";
            //oleObject.ProgId = "AcroExch.Document.DC";
            oleObject.ProgId = "Acrobat.Document.DC";

If this doesn't work for you, please provide your test PPT file for further investigation. You could send it to us via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Jun 29, 2021 10:47 am

Hello,

Greetings from E-iceblue!
Has your issue been resolved? Any feedback will be greatly appreciated.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed Jun 30, 2021 3:09 pm

my problem has not resolved. i sent the file to your support email. thanks for helping.

afciftler
 
Posts: 2
Joined: Thu Jun 24, 2021 11:22 am

Thu Jul 01, 2021 4:24 am

Hello,

Thanks for providing your input file via email.
After further analysis, I found that the progid for the PDF oleobject in your document is “AcroExch.Document.DC”. Please refer to the following code to access the PDF oleobject and download the latest Spire.Presentation Pack Hotfix Version:6.6.6 for testing. If there is any question, just feel free to contact us.
Code: Select all
            Presentation presentation = new Presentation();
            presentation.LoadFromFile("pdfoleidnotopening.pptx");

            int i = 0;
            foreach (ISlide slide in presentation.Slides)
            {
                foreach (IShape shape in slide.Shapes)
                {
                    if (shape is IOleObject)
                    {
                        IOleObject oleObject = shape as IOleObject;

                        byte[] bytes = oleObject.Data;
                        string progId = oleObject.ProgId;
                        switch (oleObject.ProgId)
                        {
                            case "Acrobat.Document.DC":
                                File.WriteAllBytes("resultAcrobat" + i+".pdf", bytes);
                                break;
                            case "AcroExch.Document.DC":
                                File.WriteAllBytes("resultAcroExch" + i+".pdf", bytes);
                                break;
                            case "package":
                                File.WriteAllBytes("resultpackage" + i+".pdf", bytes);
                                break;                               
                        }
                        i++;
                    }
                }
            }


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.Presentation

cron