DEV Community

Cover image for Add PDF OLE object into a Slide
Atir Tahir
Atir Tahir

Posted on

Add PDF OLE object into a Slide

See how to embed a document (e.g. PDF, Word, Spreadsheet) in a Presentation Slide.

string filePath = @"c:\sample.ppt";
string filePathEmbedded = @"c:\embedded.pdf";
string filePathOut = @"c:\output\result.ppt";

int pageNumber = 2;
OlePresentationOptions olePresentationOptions = new OlePresentationOptions(filePathEmbedded, pageNumber);
olePresentationOptions.X = 10;
olePresentationOptions.Y = 10;

using (Merger merger = new Merger(filePath))
{
    merger.ImportDocument(olePresentationOptions);
    merger.Save(filePathOut);
}
Enter fullscreen mode Exit fullscreen mode

All you have to do is to add GroupDocs.Merger for .NET API reference in your (new or existing) .NET project, pass the source PPT/PPTX file and the PDF that you want to embed to the API.

Top comments (0)