[Ultimate PDF] Redirect in img src causes image not to render
ultimate-pdf
Reactive icon
Forge component by Leonardo Fernandes
Application Type
Reactive

Hello,

We are using a headless content management system (Contentful) and rendering documents from the repository in HTML. We use the Ultimate PDF PrintToPdf_Advanced method to print the documents to PDF. Some of the document components in the repository are not secured (like images); these can be fetched without any repository credentials. To get around this we created a service to fetch an image using a signed URL. Any images embedded in the document have the img src attribute point to the service which creates the signed URL for the image then executes a redirect to the signed URL. This works fine in HTML but when creating the PDF, the image does not appear. We can see our service being called and it sets up the redirect to the signed URL correctly but we suspect that the redirect is being blocked in the PrintToPdf_Advanced method. If we use the unsecured image URL in the img src attribute (without the redirect), it prints correctly.

Is there a way to diagnose whether the redirect is being blocked, and if so, can you suggest a workaround?

Thanks very much.

Hi Bruce,

UltimatePDF uses a headless browser to render the html and the session is not shared for that headless browser instance. We need to pass the session cookies explicitly.  this may be the reason for your secured image url not working.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.