Free Support Forum - aspose.com

Font files otf taking too long to process

The below method is needed to render embedded fonts, if not included the fonts / text will appear as bullet points.

doc.Convert(new MemoryStream(), PdfFormat.PDF_A_1B, ConvertErrorAction.None);

However, the issue i have with the above method call, is that its takes too long to process. An extra 15 seconds compared to not using the method or using fonts which takes about 3 seconds.

@sadogeri

Thank you for contacting support.

Would you please share a narrowed down sample application along with source PDF document and font files so that we may try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using Aspose.PDF for .NET 18.9.1 in your environment.

Hello,
Attached is a demo application that shows the following issues:

  1. Slow PDF generation (which we think is as a result of the font)
  2. document size

Regards

@sadogeri

We can not find attached application reproducing this issue. Please note that upload limit on forums is 3 MB, if your data is bigger then please share it via Google Drive, Dropbox etc so that we may proceed further to help you out.

Thank you for your response. The file can be downloaded from the below link:

https://www.dropbox.com/s/w2n3r2rb0723u8w/ForAspose.zip?dl=0

Please, our major issue is the performance of the PDF generation, as it seems to take a lot of time to generate. We have changed the font from OTF to TTF fonts file types. However the time it takes to generate a pdf is still an issue

Regards
Sunday

@sadogeri

Please always share narrowed down application for reproducing the problem as there are seven projects in shared solution. Would you please elaborate necessary details about application, program flow and the problem while referencing to respective files.

Please also mention the time consumed by this application for generating the PDF file while mentioning the name of generated PDF file along with the steps to execute this, in order to reproduce the problem. We have tried to Run the application after updating Newtonsoft.Json from 4.5.1 to 11.0.2 and Aspose.PDF for .NET from 18.7 to 18.9.1 but DirectoryNotFoundException occurs. Please share requested information so that we may proceed to help you out. Exception_18.9.1.JPG

Hello Farhan,
Thank you for the response, please can you copy and paste the error / stack trace, so it can enable me address the issue you are having with the demo solution, then i will explain what needs to be done to recreate our issue.

Regards
Sunday

@sadogeri

We have managed to avoid this exception and have noticed slow execution of the program. Would you please elaborate the flow of application and other relevant details about it. It will help us if you can share SSCCE application with us so that we may investigate further to help you out. However, below is the StackTrace for your kind reference.

System.IO.DirectoryNotFoundException
  HResult = 0x80070003
  Message=Could not find a part of the path 'E:\Dunstan Thomas Files\Stanlib\INN8 Icons\piggy bank.png'.
  Source=mscorlib
  StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, 
Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Aspose.Pdf.Image.(Double& , Double& , Double& , Boolean , MarginInfo , Double , Double , Page  , List`1  , Boolean  , Boolean  , Boolean  , Paragraphs&  , Double  , Double  )
at    .()
at Aspose.Pdf.Cell.(Table , Double , Page , Double , Double , Boolean )
at Aspose.Pdf.Row.(Table , Page , Double , Double , Int32 )
at Aspose.Pdf.Row.(Table , Double& , Double& , Boolean , Double , Double , Page , Int32&  )
at Aspose.Pdf.Table.(Double& , Double& , Boolean , Double , Double , Page , Boolean , List`1  )
at    .()
at Aspose.Pdf.Cell.(Table , Double , Page , Double , Double , Boolean )
at Aspose.Pdf.Row.(Table , Page , Double , Double , Int32 )
at Aspose.Pdf.Row.(Table , Double& , Double& , Boolean , Double , Double , Page , Int32&  )
at Aspose.Pdf.Table.(Double& , Double& , Boolean , Double , Double , Page , Boolean , List`1  )
at    .()
at Aspose.Pdf.Page.(Page )
at Aspose.Pdf.Document.ProcessParagraphs()
at Aspose.PDFGenerator.CreatePDF.SIPP_Report(XmlDocument result, String location, String saveLocation) in D:\ForAspose\ForAspose\Aspose.PDFGenerator\CreatePDF.cs:line 50
at PDFCreator.Program.Main(String[] args) in D:\ForAspose\ForAspose\AsposePDFDemo\PDFCreator\Program.cs:line 37

Hello,
We have noticed that the font type MerloRoundRegular is making the pdf generation slow (50 seconds approx time) along with the built in Aspose Convert and Optimze methods. Please is there any suggestion you can provide to improve the time it takes to generate the PDf as well as have the generated PDf below 1mb?

Regards
Sunday

@sadogeri

Would you please share a narrowed down code snippet along with necessary data, so that we may try to reproduce and investigate it in our environment.

Hello Farhan,
This is a link of the app that should work in your environment:

https://www.dropbox.com/s/3gruj0p5l88f5kb/ForAspose-Updated.zip?dl=0

Our entire code base takes 1 second, but the below

public static class CreatePDF
Methods:

doc.ProcessParagraphs();
** doc.OptimizeResources**

line 50 and 51

Takes a lot of time, which is a big hit in response time, when a user request the PDF.

Please how can this be improved?

Regards
Sunday

@sadogeri

Thank you for sharing the application.

We have been able to notice long time consumption for the application shared by you. A ticket with ID PDFNET-45470 has been logged in our issue management system for further investigations. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

@Farhan.Raza

Could you provide a timescale for when you think you will be able to provide us with the results of your investigation and the next steps?

Many thanks

@DGravatt

The ticket has just been logged in our issue management system and is pending owing to previously logged tickets. It will be scheduled on its due turn which can take some months. We appreciate your patience and comprehension in this regard.

However, we also offer Paid Support, where issues are used to be investigated with higher priority. Our customers, who have paid support subscription, report their issue there which are meant to be investigated urgently. In case your reported issue is a blocker, you may please consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.

The issues you have found earlier (filed as PDFNET-45470) have been fixed in Aspose.PDF for .NET 18.11.