🍉 Meet Flexmonster Pivot Table & Charts 2.9.Check out all hot features!
Get Free Trial

Export Pdf to Serer – We can not find the parameter for server side program

Gobinath Rajamanickam asked on October 15, 2020

 Export Pdf to Serer – We can not find the parameter for server side program
 I read Documentation for ‘ExportTo’ API for save PDF to server with JSPDF object, but there is no sample or JSPPDF object reference for .Net core applications, Could you provide a sample code (PDF and HTML Server Upload) ?

3 answers

Milena Pechura Milena Pechura Flexmonster October 16, 2020

Thank you for your question.
Please kindly note that the jsPDF object is used only for PDF export using destinationType: "plain" of the exportTo params parameter. 
The "plain" value specifies that the component’s content will be returned with callbackHandler, which is used for modifying the file before export and error handling.
Taking into account your case, we suggest defining destinationType: "server" and url: 'your server'. The url value should be a link to the server-side script on your backend that will handle the pdf file. 
For HTML export, the type parameter should be changed to 'html' and the server-side script should handle the HTML files that Flexmonster sends.

var secondParam = { 
  filename : 'flexmonster.pdf', 
  destinationType : 'server', 
  url : 'your server' 
var firstParam = 'html'; // type
flexmonster.exportTo(firstParam, secondParam);

Also, we have received your email containing two questions about the export. Please note that the approach we described in this answer works for exporting from the client to the server side. If the desired component behavior is sending reports using headless browsers, please see the answer in the email.
Please let us know if it helps.
Best regards,

Aaron March 18, 2021

Hi there, 

I would also like to know the answer to this question. You haven’t really answered it here. I think the question relates to the specific parameters the Server URL expects. You just say url: ‘your server’ but you do not specify what the server url is expecting. Is it a POST with POST data or is it a query parameter that contains the report data? Or is it in the Request Headers? Is the data passed to the server as a byte array? I don’t want to have to try intercept this request using something like Fiddler just to work out how to implement it.

There is nothing in the documentation that actually explains how to actually implement the server url.

Any help in this regard would be greatly appreciated.

Milena Pechura Milena Pechura Flexmonster March 18, 2021

Hello, Aaron,
Thank you for your question.
Please find our explanations on this topic below.
When the export of PDF file to the server is performed, Flexmonster sends POST data containing the PDF binary file. 
Here are some of the headers:

Request Method: POST

Form data – filedata (binary):

Content-Disposition: form-data; name="filedata"; filename="pivot.pdf" 
Content-Type: application/octet-binary

Hope our response helped!
Please let us know if everything is clear or if you have any further questions.
Best regards,

Please login or Register to Submit Answer