Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
تعمل مقتطفات الشيفرة التالية أيضًا مع مكتبة Aspose.PDF.Drawing .
تحتوي الصور على مجموعة Resources الخاصة بكل صفحة في مجموعة Images . لاستخراج صفحة معينة، ثم الحصول على الصورة من مجموعة الصور باستخدام الفهرس المحدد للصورة.
يعيد فهرس الصورة كائن XImage . يوفر هذا الكائن طريقة Save يمكن استخدامها لحفظ الصورة المستخرجة. يوضح مقتطف الشيفرة التالي كيفية استخراج الصور من ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ExtractImageFromPDF()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "ExtractImages.pdf"))
{
// Extract a particular image
var xImage = document.Pages[1].Resources.Images[1];
using (var outputImage = new FileStream(dataDir + "ExtractedImage.jpg", FileMode.Create))
{
// Save PDF document image
xImage.Save(outputImage, System.Drawing.Imaging.ImageFormat.Jpeg);
}
// Save PDF document
document.Save(dataDir + "ExtractImages_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.