returns a Missing output file /tmp/pdftron/Trn-24 ... Error

Product: PDFNet Linux

Product Version: 9.3.0 returns false for converter.Convert(doc) call

I am using the Linux 64-bit Apryse SDK along with the HTML2PDF Linux Module for the Html2Pdf conversion on .NetCore framework. To be able to run on windows, I am using a docker container to run the application on Linux OS.

I was able to set the HTML2PDF Module path correctly as it returns true for HTML2PDF.IsModuleAvailable(). But when it’s going to actually convert the HTML string it returns false for the converter.Convert(doc).

So I searched and found some prerequisites that need to follow on Linux-based binaries. So found that there were some missing dependencies when I ran ldd ./, and installed them, also I saw that the needs execution permissions, and when I checked I could see it already has the permissions.

But still, I am getting the following error through the converter.GetLog();
Missing output file /tmp/pdftron/Trn-24-1678877572-141c1c2b-0e71-4c95-92c3-11595c3c636a

I have attached some images here, for your reference;

Can you please download the latest HTML2PDF module.

If that doesn’t work then please provide the full output of GetLog().

I tried with the new HTML2PDF Module, but still getting the error. I have uploaded the sample project I created for you to check.

This is the error that we got from the main application thrown from here

if (isConverted)
       m_logger.LogInformation("Html is being processed");
       var pdfBytes =  doc.Save(SDFDoc.SaveOptions.e_linearized);

       return Task.FromResult(pdfBytes);
       string errMessage = $"HTML to PDF conversion using Pdftron failed !,  {converter.GetHTTPErrorCode()}, {converter.GetLog()}";
       throw new Exception(errMessage);
System.Exception: HTML to PDF conversion using Pdftron failed !,  0, Missing output file /tmp/pdftron/Trn-24-1679047330-2b9738f6-caa1-4aac-8c66-6c2ff3f26343
   at DIPS.DocumentPublish.Service.WebApi.Controllers.HtmlToPdfConversionController.GetHtmlToPdfConvertedByteArray(HtmlContentRequest htmlContentRequest) in D:\CreativeSoftware\DIPS\Projects\DocumentPublish-Service\Modules\DocumentPublish\Server\DIPS.DocumentPublish.Service.WebApi\Controllers\HtmlToPdfConversionController.cs:line 82
   at lambda_method17(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

This is the error that we got from the sample project

Unhandled exception. System.Exception: Missing output file /tmp/pdftron/Trn-1-1679046986-3017cac5-4fb4-431f-8aa0-c4be20ce51bf
   at PdfTronSample.Program.PdfTronConvert() in D:\CreativeSoftware\DIPS\Work\sicknote_alignment_issue\PdfTronSample\PdfTronSample\Program.cs:line 49
   at PdfTronSample.Program.Main(String[] args) in D:\CreativeSoftware\DIPS\Work\sicknote_alignment_issue\PdfTronSample\PdfTronSample\Program.cs:line 16 (137.0 KB)
[I have removed the .so file from the `PdfTron/HTML2PDFLinux` ]

Thank you for the additional logging information.] Check failed: font_platform_data. 

This implies perhaps that there are no fonts at all on your system, or a cache is corrupted somehow.

Does the error occur with every HTML input you try?
Even a dummy HTML file like <body>Hello World!</body> ?

Yes, I have only used simple HTML files and tried with this <html><body>Hello World!</body></html> as well. Still getting the same error.
I am running the application inside a container. So it’s possible that the fonts are missing there. So how should I proceed? Shall I try installing fonts? Any hints on how to do this?

The HTML2PDF module is using fontconfig so you may want to completely remove it if you can and then reinstall.

I would recommend checking the documentation for you distro/package manager to see how to reset the fonts on the system.

1 Like

Thanks for the support, I was able to make it work once I have installed the font configuration. :slightly_smiling_face: