إعادة عينة الصور لبرنامج Excel لتحويل PDF
Contents
[
Hide
]
أثناء العمل مع ملفات Excel Microsoft الكبيرة التي تحتوي على الكثير من الصور ، قد تحتاج إلى ضغط الصور التي تمت إضافتها لتقليل حجم ملف الإخراج PDF وتحسين أداء التحويل الكلي. يدعم Aspose.Cells إعادة أخذ عينات الصور المضافة لتقليل حجم الملف الناتج PDF وتحسين الأداء.
إعادة عينة الصور لبرنامج Excel لتحويل PDF
يرجى الاطلاع على نموذج التعليمات البرمجية التالي الذي يصف كيفية تنفيذ المهمة باستخدام Aspose.Cells API. يقوم المثال بتحويل ملف Excel Microsoft إلى ملف PDF أثناء ضغط الصور في الملف.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
باستخدامPdfSaveOptions.setImageResample يقلل حجم الإخراج PDF ولكنه قد يؤثر على جودة الصورة قليلاً.
إذا كان جدول البيانات الخاص بك يحتوي على صيغ ، فمن الأفضل الاتصال[Workbook.calculateFormula ()](https://reference.aspose.com/cells/java/com.aspose.cells/workbook#calculateFormula()قبل تحويل جدول البيانات إلى تنسيق PDF. سيؤدي القيام بذلك إلى ضمان إعادة حساب القيم التابعة للصيغة ، وتقديم القيم الصحيحة في PDF.