Error using Ultimate PDF with Ajax Refresh
Application Type
Traditional Web
Service Studio Version
11.10.15 (Build 40206)

I started using Ultimate PDF and am able to print reports successfully.  Today I placed a PDF Print in screen action with Ajax Submit and I get the following error:

When I changed the screen action On Click Method to "Submit" I do not get the error.

Your assistance would be appreciated.

Leon

Solution

Hello @Leon Holmes,

To download a document in a Screen Action it's Method has to be set to 'Submit'. If it is set to 'Ajax Submit' for any reason, you will typically encounter errors like 'Server cannot set content type after HTTP headers have been sent ' or 'The connection to the server was reset' etc.

Hope this helps. If you can share why you needed to set the method to 'Ajax Submit', alternative options can be suggested.

Regards,

AJ

Hi @Leon Holmes 

First, we need to understand the difference between submit, ajax submit and navigate:

- navigation is to navigate to other screens mostly, there the preparation will hit.. so if you navigate to your own screen it will act as such.

a.k.a. GET-request

- submit is "originally" used to post your form to your post and indeed it will hit the prep. mostly used for file-uploading and the old-school way of transporting data. 

a.k.a. doing a POST-request

- ajax-submit is for speeding up things and thus NOT hitting the preparation.

a.k.a. using xmlHttpRequest with javascript.


So and applying to this case, when we do an upload or download files we need to do a (post) request to the server, that's why we need to use a submit instead of an ajax submit.


Regards,

Gonçalo Almeida

Hi Leon,

As =AJ= and Goncalo mentioned, in order to download a file, the request that sent to server must be Submit (POST). As your server action not only "make" pdf file but also download that file, hence can not be call with Ajax-Submit (So this issue is not specified to Ultimate PDF though). If you don't want to call Submit Action to download file in that page, you can work around by:

- Make a specific screen to download file (a screen that do the convert to PDF then call download action in preparation )

- At current page, set the link / button to navigate to above "download screen" with "target" property set to "_blank".  

Thank you AJ, Goncalo and Nghia.

This gives me with better understanding of the screen action's On Click method.

Regards,

Leon

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