CustomTempFonts

Hi Aspose is filling up my c:\windows\temp\ directory with 100 000+ temp files in a subdirectory called CustomTempFonts. If I delete them the temps files are soon recreated. This is happening to the point where I have disk space issues. Is there a way to stop the files being created or at least be removed once they are no longer needed?

Regards

N

hi Nick

what Version of Aspose.Pdf are you using?

Waiting for your comments

Hi Luis

22.5 PFD 22.4

Regards

Nick

you can Make this steps:

  1. Remove CustomTempFonts folder
  2. upgrade to lastest version to Aspose.PDF

ā€˜Aspose.PDF 22.7.0ā€™

if you can show me a piece of code that use , it would be great

Regards

will give that a try and let you know.

Regards

N

Hi Luis

Version 22.7.0. has the same problem. I can now replicate the problem in our dev env and can isolate the methods causing the problem. Note rolling back to 22.3.0 fixes the issue

Code Example 1

private bool SavePdfAsDoc(Aspose.Pdf.Document pdf, String convertedFileName, )
{
    try
    {
        pdf.Save(convertedFileName, Aspose.Pdf.SaveFormat.Doc);

        return true;
    }
    catch (Exception ex)
    {
        xxxx
    }

    return false;

}

Code Example 2

private bool SavePdfAsText(Aspose.Pdf.Document pdf, String convertedFileName)
{
    try
    {
        pdf.Save(convertedFileName, Aspose.Pdf.SaveFormat.Html);

        String text = System.IO.File.ReadAllText(convertedFileName, System.Text.Encoding.Default);
        text = new Earcu.Common.Routines.DataFormatting.HtmlStripper().Strip(text, 0, false);
        System.IO.File.WriteAllText(convertedFileName, text, System.Text.Encoding.Default);

        return true;
    }
    catch (Exception ex)
    {
           xxxx
    }

    return false;
}

Also you need the source document to contain a custom font

@Nick.Wiechers

Please remove the custom folder from the disk and then try the latest version of Aspose.PDF for .NET 22.7.

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input PDF.
  • Please share the screenshot of custom folder files.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

1 Like

Hi Tahir

Iā€™ve linked to a Visual Studio solution with a couple of projects which match how we are running Aspose. There is a WCF service which needs to run in IIS. The input PDF is included in the project.

Note, we get the issue with version 22.7.0 which is the version in the project. If you downgrade to 22.3.0 the issue goes away.

Iā€™ve also done some analysis with Process Monitor. When using 22.7.0, the worker process has an extra operation: CreateFileMapping with value of File Locked With Only Readers". This doesnā€™t occur with 22.3.0

Regards

Nick

[https://drive.google.com/file/d/1Yku0dXKQQkkGdyj2b8D6_i1ldzrol54D/view?usp=sharing]

In addition to the above, the OS seems to be important to the issue. It will occur if the test solution runs on Windows 10 but not Windows 11. It also occurs on Windows Server 2016

@Nick.Wiechers

It seems like we do not have access to the files shared on Google Drive. Would you please share public link of the files so that we can download them? Also, have you tried executing the same functionality in a simple console application? Did you face the similar issue there as well?

oops, sorry, try this link WCFService1.zip - Google Drive

@Nick.Wiechers

We are checking it and will get back to you shortly.

Hi Asad

Are you able to replicate the issue?

Regards

Nick

@Nick.Wiechers

We are afraid that we could not perform an initial investigation due to other parallel tasks in the queue. Nevertheless, we will soon update you on this matter in current week. Please spare us little time.

We are sorry for the inconvenience.

Hi Asad

Have you had a chance to investigate yet?

Regards

Nick

@Nick.Wiechers

We tested the scenario in our environment while using 22.8 version of the API and were unable to notice any issues. Please check the attached screenshot of the ā€œc/windows/tempā€ directory for your kind reference. Screenshot 2022-08-24 005525.png (42.3 KB)

Can you please try to test the case again using 22.8 version of the API and also, try changing the output path to see if problem still persists.

Hi Asad

Same symptoms with 22.8.

What was the OS of your test env? Weā€™ve noticed it works ok with more recent versions of Windows.

Also, if we roll back to 22.3 it works as well. I can demostrate on a call if you would be able to attend?

Regards

Nick

@Nick.Wiechers

It is hard to determine the cause of the issue without replicating it in our environment. Please check the attached screenshot for the environment information in which we performed testing: Screenshot 2022-08-24 215757.png (3.2 KB)

Along with that, we used VS2022 in order to run the application shared by you.

Hi Asad

Understood. One thing to check. In which context did you run your app pool with the WCF service? Assuming you are using ApplicationPoolIdentity, please set ā€˜Load User Profileā€™ to False. If set to true, the temp files are still created but will go in the c:\user%username%\AppData\Local\Temp\CustomTempFonts folder.