Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf.ConvertUrl, PostData, Content-Type Options
Zach Essary
Posted: Thursday, May 2, 2019 1:09:27 PM
Rank: Newbie
Groups: Member

Joined: 1/3/2017
Posts: 2
I am trying to send complex types, via Json, in the HtmlToPdfOptions.PostData property. For this to be picked up on the other end, I need to set the Content-Type header in the underlying request when calling HtmlToPdf.ConvertUrl.

I set the HtmlToPdfOptions.AdditionalHeaders property by adding "Content-Type: application/json", but this header is ignored when the post occurs. I have verified that my Content-Type header is not sent by inspecting the request on the other end. I've also verified that the posted data (byte[]) does contain my raw json as intended. I can manually take the Request.InputStream and convert that to a deserialized copy of my Json, decode that into my intended object and work with it that way. However, using MVC, it would be much better as a larger solution if I could set the Content-Type header and allow the MVC framework to parse the request normally.

Thank you in advance,
Zach
eo_support
Posted: Saturday, May 4, 2019 1:17:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,568
Hi,

We have tested this on the latest build. AdditionalHeaders does work fine, however there is a problem with PostData. We will fix it in our next build and reply here again as soon as the new build is available.

Thanks!

eo_support
Posted: Tuesday, May 14, 2019 7:44:02 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,568
Hi,

This is just to let you know that we have posted a new build that fixed the issue with PostData. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks!
David Robinson
Posted: Friday, May 17, 2019 9:40:05 AM
Rank: Member
Groups: Member

Joined: 4/6/2015
Posts: 21
Hi,
Will this PostData fix also fix missing PostData when sent using XMLHttpRequest?
Thanks
eo_support
Posted: Friday, May 17, 2019 2:11:46 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,568
Hi,

PostData has nothing to do with XMLHttpRequest. PostData is for the main request. These are the sequence of the events during the conversion:

1. The browser engine loads the main request to get the page. PostData is used for this request only;
2. The browser engine then run any JavaScript code in the page;
3. The JavaScript code can create XmlHttpRequest object to fetch additional data from wherever it prefers;

The arguments/data used in step 3 is completely controlled by the JavaScript code. It has nothing to do with PostData used in step 1.

Hope this clears up.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.