Hi
How can i extract pdf inside word document as OLEObject
Document doc = new Document();
doc.LoadFromFile(@"F:\testing\doc form\original document\8481.docx");
//traverse section
foreach (Section sec in doc.Sections)
{
//traverse section's body and find the Ole object
foreach (DocumentObject obj in sec.Body.ChildObjects)
{
if (obj is Paragraph)
{
Paragraph par = obj as Paragraph;
foreach (DocumentObject o in par.ChildObjects)
{
if (o.DocumentObjectType == DocumentObjectType.OleObject)
{
DocOleObject Ole = o as DocOleObject;
//If the string contains "Acrobat Document"(Word2003 format) or "AcroExch", it means the Ole is PDF document
string s = Ole.ObjectType;
byte[] by = Ole.NativeData;
if (s.Contains("Acrobat Document") || s.Contains("AcroExch"))
{
File.WriteAllBytes("result.pdf",by);
}
}
}
}
}
}