إعادة عينات الصور لتحويل ملفات Excel إلى PDF

إعادة عينات الصور لتحويل ملفات Excel إلى PDF

يرجى الاطلاع على الكود النموذجي التالي الذي يصف كيفية إجراء المهمة باستخدام واجهة برمجة التطبيقات Aspose.Cells. النموذج يحول ملف Microsoft Excel إلى ملف PDF مع ضغط الصور في الملف.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(ResampleImagesforExceltoPDFConversion.class);
// Initialize a new Workbook
// Open an Excel file
Workbook workbook = new Workbook(dataDir + "Book1.xlsx");
// Instantiate the PdfSaveOptions
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
// Set Image Resample properties
pdfSaveOptions.setImageResample(300, 70);
// Save the PDF file
workbook.save(dataDir + "output.pdf", pdfSaveOptions);