AddOLEObjectFrame pdf evaluation

Received : 2007/08/15 12:14:54
Message : I am trying your slides product to see if it will work with a project that we need to complete asap. I have read you forum questions/issues concerning your slides method for addOleObjectFrame. Does this method support inserting an Adobe Acrobat Document into a pdf. Powerpoint supports this, but I am not sure what this method is expecting. Can you please let me know "Class Name" for a pdf should be inside this method if it is supported?


This message was posted using Aspose.Live 2 Forum

Dear TSells,

Yes, you can extract and embed PDF document from/to PPT document using Aspose.Slides.

For extracting, please see this post.

http://www.aspose.com/Community/Forums/1/71305/ShowThread.aspx

For embedding, try this code

FileStream fin = new FileStream(“c:\sample.pdf”, FileMode.Open, FileAccess.ReadWrite);

byte[] byteStream = new byte[fin.Length + 1];

fin.Write(byteStream, 0, (int)fin.Length);

Presentation srcPres = new Presentation();

Slide srcSld = srcPres.GetSlideByPosition(1);

OleObjectFrame oof = srcSld.Shapes.AddOleObjectFrame(0, 0, srcPres.SlideSize.Width, 2000, “Adobe Acrobat 7.0 Document”, byteStream);

srcPres.Write(“c:\outPDF3.ppt”);

Hi Faiz,
I tried this but doesnt work.
Any up to date reference for this issue.
I searched on Aspose but couldnt find it

@rishi1989,

This forum is very old one and belong to legacy API, which is no more supported. Can you please share the source code used, source presentation and source PDF file that you are trying to add as OLE frame. Please also share the issue that you are facing while adding PDF as OLE frame.

Thanks, below is the error I get

“The server application,source file, or item cannot be found, or returned an unknown error. You may need to reinstall the server application”
Attached screenshot for the error.
Error.JPG (72.3 KB)

Below is the code I used.

import com.aspose.slides.IShapeCollection;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class AsposeEmbedPDF {
public static void main(String args[]) {
Presentation pres = new Presentation();
File file = new File(“H:\Data Structures and Algorithms - Alfred Aho.pdf”);
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
byte[] b = new byte[(int) file.length()];
try {
fis.read(b);
} catch (IOException e) {
e.printStackTrace();
}
IShapeCollection shapes = pres.getSlides().get_Item(0).getShapes();
shapes.addOleObjectFrame(0, 0, 100, 100, “AcroExch.Document.DC”,b);

pres.save("H:\\SampleProjects\\Presentation\\src\\AsposeScatterChart.pptx", SaveFormat.Pptx);

}
}

@rishi1989,

I have observed your comments. Can you please share source files and generated result so that we may further investigate to help you you.

pdf-sample.pdf (7.8 KB)
AsposeEmbedPdfInPpt.zip (611 Bytes)

Hi,
PFA the pdf I am trying to embed.
Not sending the pdf mentioned in above code due to large file size. Tried with the attached pdf as well it gives same error.
Also PFA the java code referring to the new pdf-sample.pdf

Also I tried replacing “AcroExch.Document.DC” with “Adobe Acrobat 7.0 Document” and “Adobe Acrobat 11.0 Document” since I am doing it in Java
Still same error.
Please address this issue on priority as its holding us to purchase license :frowning:

Any updates?

Hi @Adnan.Ahmad,
Could you please share an update here?

@rishi1989 ,

I have worked with the source file shared by you and have been able to observe the issue specified. An issue with ID SLIDESJAVA-36508 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

Thanks,
Can you please escalate this and get it done on priority.
Its one of the major blocker for purchasing the license.
Also there wasn’t any documentation for embedding a pdf into a ppt latest through java. Please add that as well if there is a working tested code for this scenario.
Ideally this should have been an out of box feature for a paid product.
Open source software like POI/dox4j etc don’t support embedding pdfs into ppt as well out of the box, However its possible through low level programming
But then this is what that should distinguish a paid product from a freeware to provide an API to do so with ease.
Kindly address this.
Thanks for your support.

@rishi1989,

I have observed the issue status and like to share that it has just been created in our issue tracking system. In order to expedite the issue resolution, you can avail paid priority support options. Please check paid priority support details link for your convenience.