| 
		
	 | 
	
	
	
		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
		 
	 | 
 | 
	
	
	
		Rank: Administration Groups: Administration
 
 
Joined: 5/27/2007 Posts: 24,427 
	 | 
		   
	     
		    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!
  
		 
	 | 
 | 
	
	
	
		Rank: Administration Groups: Administration
 
 
Joined: 5/27/2007 Posts: 24,427 
	 | 
		   
	     
		    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!
		 
	 | 
 | 
	
	
	
		Rank: Advanced Member Groups: Member
 
 
Joined: 4/6/2015 Posts: 33 
	 | 
		   
	     
		    Hi, Will this PostData fix also fix missing PostData when sent using XMLHttpRequest? Thanks
		 
	 | 
 | 
	
	
	
		Rank: Administration Groups: Administration
 
 
Joined: 5/27/2007 Posts: 24,427 
	 | 
		   
	     
		    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
		 
	 | 
 |