Filename definition in phantom-pdf



  • Hi,
    I am using the following option within template to provide the filename for the pdf but the result is a random string instead of the "Terminzettel.pdf":

    options: {
      "Content-Disposition": "attachment; filename=Terminzettel.pdf"
    }
    

    Appreciate your help!
    Jens



  • It should not be inside template. Options is another prop. See the screen

    0_1530554192031_upload-db2b767c-db5c-4fbb-92ec-03db35c3ad4c



  • Sorry. Not true what I told before.
    My options already where outside the template.

    This is what I currently have but the PDF title is still a random value!?

    options: {
      "Content-Disposition": "attachment; filename=Terminzettel.pdf"
    }
    

    ctx.response.body = result.content;
    ctx.set('Content-Type', 'application/pdf');
    ctx.set('Content-Disposition', 'attachment; filename=Terminzettel.pdf');


  • administrators

    hmm have you tried to use reportName option instead? it is described here

    {
          "template": { ... },
          "options": { "reportName": "Terminzettel" }
       }
    

    if that does not work, it will be helpful that you can upload some repository (your code is in node.js, right?) with some simple code that shows that the filename downloaded contains random value. we will check it and tell you why it happens maybe there is some mistake in your code.



  • tried the reportName and it also does not have any effect.
    filename is still like: 3a4f2114-63e6-4eba-9329-df6d55011b9b.pdf

    happy to provide source code. how should i transfer it to you?


  • administrators

    just upload it to github in a new repository and share the link here, so i will be able to download it


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.