I have the following code for image extraction from .pptx file:
public static void GetImages()
{
var doc = PresentationDocument.Open(@"D:Peak SourcingWorkppt_testxx.pptx", true);
var presentationPart = doc.PresentationPart;
var slidePart = presentationPart.GetPartsOfType<SlidePart>().First();
var imagePart = slidePart.GetPartsOfType<ImagePart>().First();
var stream = imagePart.GetStream();
var img = Image.FromStream(stream);
img.Save(@"D:Peak SourcingWorkppt_test est-output.png");
}
The code works, but is extracts just some random image from .ppt file. How to extract all images in order?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…