تحويل صور محددة إلى PDF العين اكسل الى PDF
Contents
[
Hide
]
أثناء العمل مع ملفات Microsoft Excel الكبيرة التي تحتوي على الكثير من الصور، قد تحتاج إلى ضغط الصور التي تمت إضافتها لتقليل حجم ملف PDF الناتج وتحسين أداء التحويل العام. Aspose.Cells لبرنامجPython via .NET يدعم تحويل الصور المضافة لتقليل حجم ملف PDF الناتج وتحسين الأداء إلى حدٍ ما.
يرجى الاطلاع على الشيفرة المصدرية التالية التي تصف كيفية أداء المهمة باستخدام Aspose.Cells لبرنامجPython via .NET.
This file contains 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
from aspose.cells import PdfSaveOptions, Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Initialize a new Workbook | |
# Open an Excel file | |
workbook = Workbook(dataDir + "input.xlsx") | |
# Instantiate the PdfSaveOptions | |
pdfSaveOptions = PdfSaveOptions() | |
# Set Image Resample properties | |
pdfSaveOptions.set_image_resample(300, 70) | |
# Save the PDF file | |
workbook.save(dataDir + "OutputFile_out_pdf", pdfSaveOptions) |
استخدام ال PdfSaveOptions.set_image_resample تقلل حجم ملف ال PDF الناتج لكن قد تؤثر على جودة الصور قليلاً.
إذا كانت جداول البيانات الخاصة بك تحتوي على صيغ، من الأفضل استدعاء Workbook.calculate_formula() قبل تحويل جدول البيانات إلى تنسيق PDF. وذلك سيضمن إعادة حساب قيم الصيغ الخاصة وتقديم القيم الصحيحة في الملف الناتج PDF.