34
Views
9
Comments
[Ultimate PDF] Detach applications using Ultimate PDF
Forge component by Leonardo Fernandes
15
Published on 08 Jan 2021

Hi, 

i was wondering if you could please help us with an issue?

We are trying to detach our applications from Outsystems and one of our modules is using your Ultimate PDF component to export a report in PDF format. 

We managed to detach our application without any errors but we are unable to export to PDF and are receiving "An error occurred when trying to print to pdf" error.

Are we perhaps missing a setting after detaching or could you provide any guidance on why this error would appear?

Many thanks,

Cristina

Hi Cristina,

Do manage Dependencies and untick Ultimate Pdf -> apply.

Example:

remove errors and publish your application.

Hope it's work.

Regards,

Samiksha.


Rank: #18113

hi Samiksha,

Thank you for your reply but we are unable to untick the dependency as we need the component to generate the PDF. We would lose that functionality entirely

Regards,

Cristina

mvp_badge
MVP
Rank: #5

Hi Cristina. There's no setting to be applied after the detach.

What might be happening is that the component attempts to download a Chromium browser and store it on the C:\Windows\Temp folder. If the folder is not writeable for the application pool user, then this operation will fail.

If you could provide more details about the error, I might be able to help you.

Rank: #18113

Hi Leonardo,
thank you for your reply.

Since my message the error changed a bit into "An exception occurred in the client script. Error: Cannot read property 'click' of null "

Here is what's happening:

We have a button that says Export to PDF. 

On click, this executes some validations and then triggers a click on a hidden button that performs the "PrintToPDF_Advanced" action. (i tried to make the button visible to make sure that doesn't cause a problem)
PrintToPDF_Advanced will receive an URL as input, which we build based on people's selections on the screen.

I tried the URL in the browser and it seems to display some data.

Not really sure if i'm missing something, or maybe some permissions.

You are right, on the server the c:\windows\temp folder seems to be read only. I will have to look into what users have what permissions. 

Many thanks,
Cristina

mvp_badge
MVP
Rank: #5

I believe IIS doesn't usually have write privileges to the c:\windows\temp folder, so that makes sense. Here is the documentation to grant permissions to the application pool identity: https://docs.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities


The latest release has a configuration which allows you to use a different folder other than c:\windows\temp, in case you prefer to isolate the access to a folder that is specific to Ultimate PDF. Even if you have detached already, it should be simple to merge the extension's source code into your detached version.

mvp_badge
MVP
Rank: #5

Waqar, you can try disabling the exception handling in the component itself. Remove the catch that you can find on the action PrintToPDF_Advanced.

This will unlock the actual underlying exception that is happening, and we can try to investigate it.

Rank: #9936

Hi Leonardo,

I have managed to remove the catch and error is now "Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

Kind Regards,

Waqar 

mvp_badge
MVP
Rank: #5

Ok, make sure the correct version of the Newtonsoft.Json assembly (12.0.0.0 or higher) is included in the bin folder.