How to embed pdf file into PowerPoint slide
Home › Forums › PresentationML › How to embed pdf file into PowerPoint slide
Tagged: проститутки сургута
This topic contains 6 replies, has 3 voices, and was last updated by JoyceRed 7 years, 8 months ago.
-
AuthorPosts
-
May 27, 2016 at 12:09 am #3417
Hi Eric,
I have figured out the most part on embedding pdf as an icon into ppt slide and add the action to open pdf file when the icon is clicked.
The only part I have problem is to feed the content of EmbeddedObjectPart. I have pdf file path. I used the following code to create the part:
OpenXmlPart newPart = null;
newPart = slidePart.AddEmbeddedObjectPart(“application/vnd.openxmlformats-officedocument.oleObject”);
byte[] byteArray = File.ReadAllBytes(docFile);
using (Stream newObject = newPart.GetStream(FileMode.Create, FileAccess.ReadWrite))
{
newObject.Write(byteArray, 0, byteArray.Length);
}
oid = slidePart.GetIdOfPart(newPart);embeddedObject.bin is created under \ppt\slides\embeddings folder. If I unzipped the generated pptx file and changed embeddedObject.bin to embeddedObject.bin.pdf, I can open my pdf file. But PowerPoint cannot open it when the pdf icon is clicked, instead Browse File dialog box was opened.
If I manually create a pptx file with the same pdf file embedded, and unzip the file to copy the generated oleObject1.bin from embeddings folder to my unzipped \ppt\slides\embeddings folder, and change the ole file name based on my pptx, then zip the pptx folder to recreate a new pptx file. The file works fine while pdf icon is clicked. So I think the way I load the pdf bytes to pptx is not right. What is correct way to do it?
Thanks in advance!!!
May 27, 2016 at 6:41 pm #3418Hi Eric,
Do you know how Productivity Tool reads embedded objects in pptx? It loads all the objects, like image, video, audio, pdf, etc., into different string variables. If I use the string variable content created by Productivity Tool for embedded pdf, my code works. Do you know if Productivity Tool is open source on GitHub?
Thanks in advance!!!
May 27, 2016 at 7:13 pm #3419Hi Eric,
I realized my code for reading pdf content is correct. The problem is PowerPoint adds some header content before pdf content during embedding the ole object. I compared embedded pdf (oleObject1.bin) and my original pdf file. I see oleObject1.bin replaces the starting string -%PDF-1.5 – with some other header information then following with the rest of the original pdf content.
May 27, 2016 at 10:22 pm #3420PowerPoint adds header and footer into the original PDF file to create its oleobject.bin file in pptx. Does OpenXml SDK have api to handle all of this to load original pdf file?
Thanks in advance!!!
May 31, 2016 at 9:35 pm #3428Hi Eric,
I realized that in order to embed a document into pptx file the document has to be wrapped as ole object. Does OpenXml SDK provide API to convert PDF to OLE object? If not, do you have some knowledge on doing so in C#?
Thanks in advance!!!
June 13, 2016 at 7:33 pm #3473Hi,
Very sorry for the long delay in response. I have been heads-down in a rather difficult but very cool Open XML project – I’ll be blogging on this within the next two days.
The Open-Xml-SDK is capable of creating any Open XML document. It is only a matter of creating the right markup, the right parts with the right XML or binary content, and creating proper content and relationship types. Key point is to use the Open XML SDK Productivity Tool to help you figure out what that is.
I don’t have any specific experience on embedding PDFs into presentations. I have successfully created files with embedded OLE objects, so I do know it is possible. Make sure that your content types and relationship types are correct.
Sorry again for the slow response.
March 10, 2017 at 4:50 am #4222Во многих городах зарплаты не позволяют мужчинам осуществлять поездки в дальние заморские страны, покупать автомобили громких брендов и скупать недвижимость. проститутки сургута
Однако мы предлагаем всем представителям сильного пола не менее приятное удовольствие, на которое не придется тратить все оставшиеся деньги проститутки сургута
Самые обаятельные и красивые проститутки Сургута с удовольствием проведут с вами ночь по самой низкой цене. проститутки сургута -
AuthorPosts
You must be logged in to reply to this topic.