3

I am using the IronPDF library in one of the endpoints of my REST API using ASP.NET Core 3.1. The library successfully converts my custom HTML to a PDF and a file is returned. If I send another request to the same endpoint, code execution reaches where I enable logging, but does not go any further and request are labeled as "(pending)" in Chrome. If I keep sending requests, that route no longer runs code while other routes work perfectly fine. I have tried rendering both a url and custom html and neither work after the first request. I'm not sure if it is my code that is failing, a limitation of IronPDF, or an issue with IronPDF that is causing issues. Any help pointing me in the right direction is appreciated.

OS: macOS Big Sur 11.4
Target Framework: netcoreapp3.1

appsettings.json

{...
    "IronPdf.LicenseKey": "IRONPDF.COMPANY......"
...}

Controller.cs

[HttpGet]
[Route("report")]
public IActionResult GetReport(){
    IronPdf.Logging.Logger.EnableDebugging = true;
    IronPdf.Logging.Logger.LogFilePath = "Default.log";
    IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;

    var render = new IronPdf.ChromePdfRenderer();
    var doc = render.RenderHtmlAsPdf("<div>Test</div>");

    return File(doc.Stream.ToArray(), "application/pdf");
}

Snippet of Console Logs

11:48:12 (0x70000ede0000): Loaded frame 'https://ironsoftwarescheme.com/'
11:48:12 (0x70000ede0000): Executing dev tools method 'Emulation.setEmulatedMedia' for browser 1
11:48:12 (0x70000ede0000): Received dev tools message on browser 1: '{"id":1,"result":{}}' (size: 20)
11:48:12 (0x70000ede0000): Finished dev tools method on browser 1 (message ID: 1)
11:48:12 (0x70000ede0000): Sending DOM-visit process message for browser 1 (job ID: 0)
11:48:12 (0x115f26e00): Message received from process 0
11:48:12 (0x115f26e00): Visiting DOM of 'https://ironsoftwarescheme.com/'
11:48:12 (0x115f26e00): DOM reported document title of 
11:48:12 (0x115f26e00): Finished HTML visit, invoking callback
11:48:12 (0x115f26e00): DOM-visit finished for browser 1
11:48:12 (0x115f26e00): DOM-visit generated base-64 string 'AQAAAGgAAAAAAAAAAgAAAEQAAAAQAAAAAAAAAAAAAAABAAAAOAAAAAEAAAANAAAAZAAAAG8AAABjAAAAdQAAAG0AAABlAAAAbgAAAHQAAAB0AAAAaQAAAHQAAABsAAAAZQAAAAEAAAAEAAAAAQAAAAAAAAA='
11:48:12 (0x115f26e00): Sending process message from render process to browser process
11:48:12 (0x115f26e00): Successfully sent message to browser process
11:48:12 (0x70000ede0000): Browser process received message: 'OnDomVisited'
11:48:12 (0x70000ede0000): Received message from render process with values 'AQAAAGgAAAAAAAAAAgAAAEQAAAAQAAAAAAAAAAAAAAABAAAAOAAAAAEAAAANAAAAZAAAAG8AAABjAAAAdQAAAG0AAABlAAAAbgAAAHQAAAB0AAAAaQAAAHQAAABsAAAAZQAAAAEAAAAEAAAAAQAAAAAAAAA=' (156)
11:48:12 (0x70000ede0000): Printing from browser to '/var/tmp/pdfoZGBeL'
11:48:12 (0x70000ede0000): Received browser print callback for path '/var/tmp/pdfoZGBeL' (1)
11:48:12 (0x70000ede0000): Print finished for browser 1(success: 1)
11:48:12 (0x70000ede0000): No document title found
11:48:12 (0x70000ede0000): Retrieve Html title: 
11:48:12 (0x70000ede0000): Generating form fields
11:48:12 (0x70000ede0000): Adding default font for form fields
11:48:12 (0x70000ede0000): Initializing forms for page 0
11:48:12 (0x70000ede0000): Retrieving document bytes
11:48:12 (0x70000ede0000): Pdf document factory is generating bytes using document pointer 0x7fb6f026b8b0
11:48:12 (0x70000ede0000): Pdf document factory succesfully generated bytes 0x7fb6f026b8b0
11:48:12 (0x70000ede0000): Successfully generated 6674 bytes from Pdf document factory writer
11:48:12 (0x70000ede0000): Closing browser 1
11:48:12 (0x70000ede0000): Received dev tools message on browser 1: '{"method":"Inspector.detached","params":{"reason":"Render process gone."}}' (size: 74)
11:48:12 (0x70000ede0000): Destroying browser (id:1)
11:48:12 (0x70000ede0000): Finished job 0
11:48:12 (0x70000ede0000): Job group finished
11:48:12 (0x70000ede0000): Job group 0 finished
11:48:12 (0x70000ede0000): CefProxyController::QuitMessageLoop()
11:48:12 (0x70000ede0000): CefMessagePumpStd::Quit()
11:48:12 (0x70000ede0000): CefMessagePumpStd::DoQuit()
11:48:12 (0x70000ede0000): Retrieving 6674 bytes from job 0
Retrieved license key from config 
Retrieved license key from config 
/**
 End of first request
*/

---------- IronPdf Logging Started at '/Users/firstname.lastname/Source/repos/my-api/src/Namespace.RestApi/Default.log' ----------
---------- IronPdf Logging Started at '/Users/firstname.lastname/Source/repos/my-api/src/Namespace.RestApi/Default.log' ----------
/**
 End of second request (Gets stuck here)
*/
samehope92
  • 31
  • 6
  • 1
    Same issue with dotnet core 5 on macos. You could try to run it inside a docker container. – Waytal Mar 08 '22 at 10:50

1 Answers1

0

While an issue with second-rendering attempts failing in MacOS was present in an earlier version of IronPdf, this was resolved in IronPdf 2021.11.4183.

Current version (as of 2021-12-08), IronPdf 2021.12.4495.

Extended log file provided directly to Iron Software support show that instead what is seen here is a rendering timeout.

By design, ​IronPDF's rendering timeout is now 60 seconds. Anything that would take longer than 60 seconds to render would not complete with further instruction.

(This timeout will made clearer in the next update of IronPdf 2021.12).

To override the default timeout, set RenderingOptions.Timeout as shown below:

RenderingOptions.Timeout = 120; // seconds;
RenderingOptions.RenderDelay = 30000; //milliseconds

Please note that setting a render delay higher than a set timeout will produce an exception.

MSDN-style API documentation: RenderingOptions.Timeout

darren
  • 475
  • 4
  • 15