2

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?

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38
LINKeRxUA
  • 559
  • 6
  • 26

2 Answers2

2

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.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38
  • @LINKeRxUA, I never updated you but this was changed. I added it today to the documentation. Refer to http://www.cloudformatter.com/CSS2Pdf.APIDoc.Usage for the changes. There is a new option 'filename' you can pass to set the name of the downloaded PDF. – Kevin Brown Jun 14 '15 at 23:17
  • Thank you. Will use this option in next project! Have a nice day. – LINKeRxUA Jun 15 '15 at 08:12
0

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
Negi Rox
  • 3,828
  • 1
  • 11
  • 18