Rééchantillonner les images pour la conversion Excel vers PDF

Rééchantillonner les images pour la conversion Excel vers PDF

Veuillez consulter l’exemple de code suivant qui décrit comment effectuer la tâche à l’aide du Aspose.Cells API. L’exemple convertit un fichier Excel Microsoft en un fichier PDF tout en compressant les images dans le fichier.

// 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);