We have used below code for optimizing the PDF but the result of the optimization is not stable.
For example a 170kb PDF after optimization we got 150kb whereas another PDF with 100kb after optimization we got 110kb. So there is 10kb increase in size after optimization.
We would like to know which all components have been edited for getting smaller and larger size after optimization.
using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(fileName))
{
try
{
doc.OptimizeResources();
doc.Save(fileName);
}
catch
{
}
}
We have purchased Aspose.PDF and we are happy to share the details if required.
But we are getting few exceptions for different PDFs, like - “Parameter is not valid”, “Object reference not set to an instance of an object”, “An item with the same key has already been added” and “Font subsetting is prohibited because of license restrictions”. I have attached sample PDFs for these exceptions.
Also, in some cases, still the size increases after optimization(sample PDF attached).
Also,
2. We would like to know if there is any functionality in Aspose.PDF to consolidate all duplicate fonts. The reason I ask is the PDF generated from Aspose is opened by clients in Adobe Acrobat Standard DC. When we do ‘Save As’ in Acrobat Standard it shows “Consolidating Duplicate Fonts” and hangs. We would like to generate a PDF where fonts are already consolidated. We want to make Embedded fonts or Subsetted fonts display as single Font Family in the Font properties.
We have been able to notice the mentioned issues in our environment and logged them as:
PDFNET-48728
PDFNET-48729
PDFNET-48730
PDFNET-48731
We will further look into their details and keep you informed about the status of their correction. Please be patient and spare us some time.
Could you kindly share the screenshot of the error that Adobe Reader shows and hangs? Furthermore, please share the problematic source PDF, output PDF, and an expected output document for our reference so that we can further proceed to assist you accordingly.
Below is the screenshot from Adobe Acrobat Standard DC showing “Consolidating duplicate fonts”. This message is shown while we use Save As to save a copy of large PDFs which are greater than 10MB and contains duplicate fonts as in attached screenshot.
Most of the PDFs with size less than 25MB gets saved without any issues where the message “Consolidating duplicate fonts” completes within 5 to 10 seconds. In case of large PDFs about 66MB and more than 100 duplicate fonts, the Save As functionality in Adobe Standard gets stuck at “Consolidating duplicate Fonts” for about 1 or 2 hours and then crashes.
Below is a sample PDF which shows 8 fonts out of which 4 are duplicates. We would like to remove the duplicate fonts and display as 4 fonts instead of 8.
Also, please note that this issue does not happen in Adobe Reader DC. It happens only in Adobe Acrobat Standard/Professional version. Also it does not happen in PDFs with less than 10MB.
Please let us know if you need further information.
We have logged an investigation ticket as PDFNET-48742 in our issue management system after testing the scenario in our environment. We will further look into its details and inform you as soon as it is resolved. Please be patient and spare us some time.
Can we get an estimate of when we will get a solution or workaround for these issues?
Please let us know if there is a provision in Aspose to consolidate fonts in an existing PDF, or consolidating fonts while merging multiple PDF. We tried setting IsSubset to false and it does not work. Also tried unembedding-saving-reembedding and it does not work either. Sometimes the text becomes unreadable and scrambled while doing this.
We are afraid that we cannot share any reliable ETA at the moment as tickets are pending for review. They will be investigated and resolved on a first come first serve basis. We will surely inform you as soon as they are resolved. Please give us some time.
Following options are used during optimization in order to unembed or remove duplicate fonts from PDF:
Regretfully, they seem not to be working in your case and we need to further investigate the actual reasons behind it. The ticket PDFNET-48742 has been logged and dedicated for this issue specifically. We will inform you as soon as we have additional updates in this regard.
Please note that not only the file size increases from 94KB to 130KB, but also the pages 2 and 3 becomes unreadable after optimization. This happens when we use “SubsetFonts = true”.
Please let us know the solution for this issue. If you could let us know under what conditions these fonts become unreadable, we could make “SubsetFonts = false” for those conditions. Please give high priority for fixing this.
We have logged an issue as PDFNET-48897 in our issue tracking system after replicating it with Aspose.PDF for .NET 20.10. We will surely look into its details and keep you posted with its rectification status. However, please also note that it will be investigated and fixed on first come first serve basis as per free support policies. We request your patience and comprehension in this matter. Please give us some time.
Is there any way you could expedite and provide a solution? We have been pushing these issues over to subsequent sprints several times. It would be nice if you could provide an ETA. Please let us know how we could move this to paid support.
We are afraid that we cannot provide any ETA at the moment as investigation against the tickets is not yet completed. Furthermore, the issues in free support model are resolved on first come first serve basis. The resolution time of the issue depends upon the complexity of the issue and number of issues logged prior to it. We really apologize for the inconvenience being faced. We will surely inform you as soon as we have some definite updates regarding tickets resolution.
In case you are subscribed to paid support, you can login there using the same email address which was used to purchase subscription. You need to create a post there with the reference of ticket which you want to get resolved on urgent basis and it will be expedited accordingly.
Could you please let us know the status of the investigation tickets?
Our goal is to accomplish below two tasks, which is currently not working with Aspose.PDF in some cases-
Compress PDFs
Consolidate fonts in PDF (while merging PDFs / in a single PDF)
Also, please let us know the complete procedure to avail paid support.
We really regret to inform that investigation against earlier logged tickets is not yet completed due to other issues logged prior to it. However, we will surely let you know about the ETA as soon as we complete analysis. We highly appreciate your patience and comprehension in this regard. Please give us some time.
Please create an inquiry/post in our Purchase Forum in order to get related assistance.
We really regret to share that earlier logged ticket are not yet fully reviewed and we are not in a position to share some reliable ETA at the moment. We will surely let you know as soon as we have some certain updates in this regard. We highly appreciate your patience and cooperation in this matter. Please give us some time.
Hi @asad.ali
As this issue was pending from your side for a long time, do you have any available fix for the above issue?
If no, please share the next level of escalation contact details for further assistance.
We are afraid that earlier logged tickets are not yet resolved due to other pending issues which were logged previously. However, you can please check our priority support option where issues are dealt on urgent basis. We will further inform you as soon as we have some definite updates regarding tickets resolution.