إعادة أخذ عينات الصور المضافة - من Excel إلى تحويل PDF
Contents
[
Hide
]
أثناء العمل مع ملفات Excel Microsoft الكبيرة التي تحتوي على الكثير من الصور ، قد تحتاج إلى ضغط الصور التي تمت إضافتها لتقليل حجم ملف الإخراج PDF وتحسين أداء التحويل الكلي. يدعم Aspose.Cells إعادة تشكيل الصور المضافة لتقليل حجم ملف الإخراج 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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Initialize a new Workbook | |
// Open an Excel file | |
Workbook workbook = new Workbook(dataDir+ "input.xlsx"); | |
// Instantiate the PdfSaveOptions | |
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); | |
// Set Image Resample properties | |
pdfSaveOptions.SetImageResample(300, 70); | |
// Save the PDF file | |
workbook.Save(dataDir+ "OutputFile_out_pdf", pdfSaveOptions); |
باستخدام ملفSetImageResampleيقوم الخيار بتصغير حجم الإخراج PDF ولكنه قد يؤثر على جودة الصورة قليلاً.
إذا كان جدول البيانات الخاص بك يحتوي على صيغ ، فمن الأفضل الاتصالالمصنف .CalculateFormula ()مباشرة قبل تحويل جدول البيانات إلى تنسيق PDF. سيؤدي القيام بذلك إلى ضمان إعادة حساب القيم التابعة للصيغة ، وتقديم القيم الصحيحة في PDF.