We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unexpected font parsing exception when running PdfEditor.Concatenateon AWS Lambda

I’m using Apose.Words and Aspose.PDF for C#.

I have a project that converts a bunch of Word documents to PDFs, and then attempts to concatenate those PDFs into a single document. It works fine on my local Windows box, but when I deploy to AWs and try to run the Concatenation, I get:

Unexpected font parsing exception —> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘/usr/share/fonts/truetype/msttcorefonts’.

I’ve been researching all night and am at a dead end. How do I correct this so I can run this function in the AWS Lambda Unbuntu environment?

I can give you access to the GitHub repo hosting the C# Lambda function, the code is short and straightforward.



Thank you for contacting support.

Would you please specify if the exception is being thrown by Aspose.Words for .NET or Aspose.PDF for .NET API. Please also share narrowed down code snippet reproducing this issue so that we may try to reproduce and investigate it in our environment.

The exception is coming from the PdfEditor. Here’s the code:

var pdfEditor = new PdfFileEditor();

      //  pdfEditor.CorruptedFileAction = Aspose.Pdf.Facades.PdfFileEditor.ConcatenateCorruptedFileAction.ConcatenateIgnoringCorrupted;
        pdfEditor.AllowConcatenateExceptions = true;


        using (MemoryStream pdfStream = new MemoryStream())
            Console.WriteLine($"Creating a PDF from {documents.Count} documents");

            var inMemoryDocuments = documents.ToArray();
            Console.WriteLine($"Stream 1 has {inMemoryDocuments[0].Length} bytes");
            var result = pdfEditor.Concatenate(inMemoryDocuments, pdfStream);

            if (!result)
                Console.WriteLine("Warning: Concatenation failure detected");
                throw pdfEditor.LastException;

            if (pdfEditor.CorruptedItems != null && pdfEditor.CorruptedItems.Length > 0)
                Console.WriteLine("Corrupted documents:");
                foreach (Aspose.Pdf.Facades.PdfFileEditor.CorruptedItem item in pdfEditor.CorruptedItems)
                { Console.WriteLine(item.Index + " reason " + item.Exception.Message); }

            // and we're good
            var buffer = pdfStream.ToArray();

            Console.WriteLine("Combined document is " + buffer.Length + " bytes");
            await wc.UploadDataTaskAsync(request.OutputUri, "PUT", buffer);


Again - this works fine on Windows, but errors out on AWS Lambda, which I think is an Ubuntu environment.


Thank you for sharing further details.

We have logged a ticket with ID PDFNET-45891 in our issue management system for further investigations about DirectoryNotFoundException for default folder by Aspose.PDF for .NET. We will let you know as soon as some significant updates will be available in this regard.

Any ETA on this? I’m kind of dead in the water. I want to buy this product but can’t until this is resolved.


We are afraid that scheduling this ticket may take some more time. However, we have recorded your concerns and will let you know as soon as some significant updates will be available in this regard.

Any timeline? Will it be in the next few weeks? If not i’m going to have to start using something else.


We would like to update you that PPDFNET-45881 has been marked as resolved in Aspose.PDF for .NET 19.2. Tentative date for release of this version is around second week of February 2019. We will notify you as soon as the product will be released.

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


Now I get a different error. Same deal as before - it works locally, but in Lambda, I get this:

One or more errors occurred. (Object reference not set to an instance of an object.): AggregateException
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at lambda_method(Closure , Stream , Stream , LambdaContextInternal )

at Aspose.Pdf.Facades.PdfFileEditor.#=zXs98IxU=(Exception #=zWMz_CO0=)
at Aspose.Pdf.Facades.PdfFileEditor.Concatenate(Stream[] inputStream, Stream outputStream)
at platform_pdf_generation.PDFGenerationEngine.GeneratePDFs(GeneratePDFsRequest request,         ILambdaContext context) in D:\rhythm\platform-pdf-generation\platform-pdf-    generation\PdfGenerationEngine.cs:line 117

Please assist.


If possible, can your engineers test on .NET core on AWS Lambda? Anyone trying to use this lib on AWS is going to struggle…



Thank you for getting back to us.

We have recorded your comments and will update you as soon as any significant update will be available in this regard.

Guys… anything? Really want to use this.

On another note, you should really consider publishing a Lambda layer…


Thank you for getting back to us.

We would like to update you that we have logged another ticket with ID PDFNET-46080 for AggregateException in .NET Core on AWS Lambda . We will let you know once it is resolved. We appreciate your patience and comprehension in this regard.

Hey Andrew,

Have you fixed this problem now?

I want to convert and concatenate those PDF using Aspose on AWS Lambda too. I’d not tried yet but it seems I will get the same issue, if this problem is unsolved…

Hi Farhan,

I want to buy this product and put it on AWS Lambda. Have you got any update on supporting Lambda now?



Thank you for contacting support.

We are afraid PDFNET-46080 has not been scheduled yet. However, you may test the API in its full capacity by applying a free 30-days temporary license. Once you complete evaluation process, you may purchase the license to keep using APIs features. In case you face any issue, please feel free to let us know.