Search code examples
jquery-pluginspdf-generationcss-to-pdf

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


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?


Solution

  • 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.