xep.cloudformatter.com : HTML to PDF. How to change filename of repsonse of Content-Desposition header?

1.1k Views Asked by At

using xepOnline.jqPlugin.008.js I have HTML to PDF generated file which name is 'doucment.pdf' How can I force to rename this file for example to abc.pdf ?

Or maybe is there any way to change 'on live' response header?

2

There are 2 best solutions below

2
On BEST ANSWER

As one of the authors, I checked the source code for the formatting service:

   WebOperationContext.Current.OutgoingResponse.ContentType = mimeTypeOut;
   String headerInfo = "attachment; filename=document." + fileext;
   WebOperationContext.Current.OutgoingResponse.Headers["Content-Disposition"] = headerInfo;

So the answer from this is that it always delivers back "document." and the file extension of the type (could be PDF, PS, AFP, ...). I will put in a change request to add an optional name to be passed into the request so that you can set the name of the result file. I will update this answer with the change when finished.

0
On

For file name you just need to pass a filename key in options just like below.

var options={
             render:'download', // force to download fix for IE
             embedLocalImages:'true', // enable images in PDF
             filename:'testPdf' // filename changed
            }
 xepOnline.Formatter.Format('content',options); //content is div container