Hi @asad.ali,
Can we have an update on this issue?
Thanks,
Avinash.
We are afraid that no updates are available regarding tickets resolution. We will let you know within this forum thread as soon as we have some news about their fix.
We apologize for the inconvenience.
Regretfully, the tickets have not been completely investigated yet. As soon as analysis is completed, we will share updates with you within this forum threads. Please spare us some time.
We apologize for the inconvenience.
We regret to inform that no update is available at the moment regarding ticket(s) resolution. As shared earlier, we will surely inform you once they are completely investigated and rectified. We highly appreciate your patience and cooperation in this matter. Please give us some time.
We really apologize for the inconvenience and delay.
We would like to share with you that both tickets have been scheduled for fix in 21.4 version of the API which will be released in April 2021. We will post a notification in this thread as soon as the fixed-in version is available.
We apologize for the delay and inconvenience faced.
We have investigated the logged ticket PDFJAVA-39802. Regretfully, we do not have a way to convert a CFF font with a negative glyph width from PDF to a Subset TrueType font at the moment.
The same problem was tested for the same input file in another issue PDFJAVA-39405. Please do not use the following option if document uses CFF font with a negative glyph width:
optimizationOptions.setSubsetFonts(true);
We are afraid that the ticket PDFJAVA-39801 is not yet resolved. It is under the phase of investigation and as soon as we have additional updates regarding its resolution, we will share with you. Please give us some time.
We are sorry for the inconvenience.
Hi @asad.ali,
We are implementing the shared code now with exposing option to enable/disable the functionalities like SetSubsetFonts, SetRemoveUnusedStream, RemoveUnusedObjects.
Earlier I raised a query asking about functionality of each of the mentioned parameters. As it was mentioned by you earlier that OptimizeFileSize and OptimizationOptions.SubsetFonts has same functionality i.e applying font subsets to fonts used in the doc.
So, I tried testing the shared code, once with only PdfFormatConversionOptions.optimizeFileSize(true) and got this result :OptimizeFileSize.pdf (1.1 MB) where texts are scattered and are not in actual place.
for second time I tried with enabling only OptimizationOptions.setSubsetFont(true) and output was fine. SetSubsetFonts.pdf (1.1 MB)
Also, Output file sizes are different for both of them.
Thanks,
Avinash.
Can you please also share the respective source PDF document with us so that we can test the scenario in our environment and address it accordingly.
Please find the input pdf file below:
T-PVS-DE(2018)11.pdf (1.2 MB)
Respective input docx file as well
T-PVS-DE(2018)11.docx (175.7 KB)
Thanks,
Avinash.
We tested the scenario while using 21.5 version of the API and did not notice any issue in output PDF documents. However, the size of the output PDF was 14MB in both cases. We will further investigate and address this issue. Please confirm if you are using the same code as shared below? Please also test with 21.5v before sharing your feedback.
Document doc = new Document(dataDir + "T-PVS-DE(2018)11.pdf");
PdfFormatConversionOptions options = new PdfFormatConversionOptions(PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
options.setOptimizeFileSize(true);
doc.convert(options);
doc.save(dataDir + "optimizefilesize.pdf");
doc = new Document(dataDir + "T-PVS-DE(2018)11.pdf");
PdfFormatConversionOptions opts = new PdfFormatConversionOptions("logFile.Txt", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
doc.convert(opts);
com.aspose.pdf.optimization.OptimizationOptions optimizationOptions = new com.aspose.pdf.optimization.OptimizationOptions();
optimizationOptions.setSubsetFonts(true);
doc.optimizeResources(optimizationOptions);
doc.save(dataDir + "subsetfonts.pdf");
Hi @asad.ali,
Looks like there is some misunderstanding from your end, My query is totally different.
As you have explained here,
In our existing code we have used optimizeFileSize for Optimization purpose. Now we are implementing the new code with class OptimizationOptions.
So, While testing the code, as per your mention:
“OptimizeFileSize is applying font subsets to fonts used in the document.I.e. this is the same as OptimizationOptions.SubsetFonts”
I was using OptimizefileSize instead of OptimizationOptions.SubsetFonts and got this output OptimizeFileSize.pdf (1.1 MB) where texts are scattered.
Code:
com.aspose.pdf.Document doc = new com.aspose.pdf.Document("C:\\Users\\Administrator\\Desktop\\New folder\\AsposePDFATest\\Test5.pdf"); PdfFormatConversionOptions opts = new PdfFormatConversionOptions("C:\\Users\\Administrator\\Desktop\\New folder\\AsposePDFATest\\logFile.Txt", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete); opts.setConvertSoftMaskAction(ConvertSoftMaskAction.ConvertToStencilMask); opts.setOptimizeFileSize(true); doc.convert(opts); OptimizationOptions optimizationOptions = new OptimizationOptions(); //optimizationOptions.setSubsetFonts(true); optimizationOptions.setRemoveUnusedStreams(true); optimizationOptions.setRemoveUnusedObjects(true); doc.optimizeResources(optimizationOptions); doc.save("C:\\Users\\Administrator\\Desktop\\New folder\\AsposePDFATest\\OutputPDFA.pdf");
But on using OptimizationOptions.SubsetFonts, It worked fine: SetSubsetFonts.pdf (1.1 MB)
Code Used:
com.aspose.pdf.Document doc = new com.aspose.pdf.Document("C:\\Users\\Administrator\\Desktop\\New folder\\AsposePDFATest\\Test5.pdf"); PdfFormatConversionOptions opts = new PdfFormatConversionOptions("C:\\Users\\Administrator\\Desktop\\New folder\\AsposePDFATest\\logFile.Txt", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete); opts.setConvertSoftMaskAction(ConvertSoftMaskAction.ConvertToStencilMask); //opts.setOptimizeFileSize(true); doc.convert(opts); OptimizationOptions optimizationOptions = new OptimizationOptions(); optimizationOptions.setSubsetFonts(true); optimizationOptions.setRemoveUnusedStreams(true); optimizationOptions.setRemoveUnusedObjects(true); doc.optimizeResources(optimizationOptions); doc.save("C:\\Users\\Administrator\\Desktop\\New folder\\AsposePDFATest\\OutputPDFA.pdf");
So, My queries are:
Thanks,
avinash.
We totally understood your query and had tested the scenario in our environment using both ways i.e.:
However, at our end, we obtained similar output PDFs for both cases. Text was not scattered in any of the obtained output PDF. Please also note that there was no other dependency which was added at our end.
The only difference we noticed was that the size of PDF outputs (in both cases) was bigger than the source PDF. Hence, we requested you to test the case using 21.5 version and confirm if you are also noticing the same behavior as we did so that we can further proceed to assist you accordingly. In case we still missed something, please let us know.
Hi @asad.ali ,
Please try with the shared code from here, you will find the issues as i mentioned:
You have just tried with
optimizationOptions.setSubsetFonts(true);
Or
opts.setOptimizeFileSize(true);
Please add optimizationOptions.
> setRemoveUnusedStreams(true);
> optimizationOptions.setRemoveUnusedObjects(true);
as well and test. setOptimizeFileSize.pdf (1.1 MB)
I have tested it wit Aspose.PDF 21.5.
Thanks,
avinash.
We were now able to reproduce the similar behavior which you mentioned by using Aspose.PDF for Java 21.5. Therefore, an investigation ticket as PDFJAVA-40575 has been logged in our issue tracking system for the sake of correction. We will let you know once the ticket is resolved. Please give us some time.
We are sorry for the inconvenience.