Hello,
I have huge spreadsheets (about 1000 rows x 500 cols + images per sheet).
I want to prepare file to view as pdf using Viewer with spreadsheetOptions: ForOnePagePerSheet
option.
var viewer = new Viewer(stream, loadOptions);
...
viewer.View(pdfViewOptions, cancellationToken);
Output is converted correctly (1 sheet to 1 page, after zooming document is readable) but the document:
- is very heavy (xlsx spredsheet 1,6MB, pdf output 11MB)
- when I open document for example in document reader rendering take a very long time, also in others viewer
Can you give some advice to make output document more responsive (and smaller)?
Any optimized options etc?
I Use .NET 6 and GroupDocs.Viewer 22.11.0
@D04486411
Thank you for sharing the details.
There are no optimization options available when rendering to PDF. Can you please attach a sample file so we take a look and see what we can do here?
Here is sample file compressed to 7z. I can’t attach output file because size limit.
sample.7z (188.5 KB)
@D04486411
Thank you for attaching the sample input file. We’ll take a look at what optimizations we can apply and update you.
@D04486411
At the moment we can add a property to enable the following optimizations: do not embed common fonts like Arial and Times New Roman, and optimize the file structure to reduce the size. When applied to the file you attached output size is reduced by 41% to 6.61 MB from 11.2 MB. Links to both optimized.pdf and not-optimized.pdf files.
In case you’re OK with such optimizations we can add this property to enable them in the upcoming release.
It would be great if you included these options. Can you also add an option for pdf linearisation?
When can we expect a new release?
Regards
@D04486411
We’ll investigate if linearisation can be added and update you.
We have plans to publish the next version by the end of the next week.
1 Like
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): VIEWERNET-4211
You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@D04486411
This feature was shipped in GroupDocs.Viewer 23.1. The package is available at NuGet and GroupDocs.Downloads.
Have a nice day!
@D04486411
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): VIEWERNET-4330
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@D04486411
In GroupDocs.Viewer for .NET 23.6 we have added support for more PDF optimizations including linearization. Learn more in the following topic Optimize the output PDF file. The code sample:
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...
using (Viewer viewer = new Viewer("invoice.pdf"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions
{
Lineriaze = true, // Optimize PDF for web-browsers
OptimizeSpreadsheets = true, // Optimize spreadsheets for a smaller size
SubsetFonts = true, // Keep the characters that actually used
RemoveAnnotations = true, // Remove annotations
RemoveFormFields = true, // Remove form fields
ConvertToGrayScale = true, // Convert images to grayscale
CompressImages = true, // Enable images compression
ResizeImages = true, // Enable resize images with lower resolution
MaxResolution = 150, // Set resolution for images, default value is 300
ImageQuality = 30, // Set image quality, default value is 100
};
viewer.View(viewOptions);
}
We have also update public API to optimize spreadsheets and now you have to set PdfOptimizationOptions.OptimizeSpreadsheets
to true
instated of PdfViewOptions.Optimize
.
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...
using (Viewer viewer = new Viewer("invoice.xlsx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions
{
OptimizeSpreadsheets = true, // Optimize spreadsheets for a smaller size
};
viewer.View(viewOptions);
}
The version is available at
Have a nice day!