Cannot download pdf file again

Hello,

I’ve created a server side route like this:

Router.route('/downloadpcslist/:taskId', function() {
    var task = Task.findOne({_id: this.params.taskId});
    if(task) {
        var doc = new PDFDocument({size: "a4", margin: 8});
        createPDFDocument(doc, task);
        var filename = task.task_nostring + "_stueckliste";

        this.response.writeHead(200, {
            'Content-type': 'application/pdf',
            'Content-Disposition': "attachment; filename="+filename+".pdf"
        });
        this.response.end(doc.outputSync());
    }
}, {where: 'server'});

and I am calling this route via Router.go("/downloadpcslist/" + taskid) from my event.

It works well and I can download the pdf file, but if I try it to download the file again it doesn’t work, it feels like my application crashes, because if try to execute any events on my site it also doesn’t work. I can only download the file again if I reload the page.

I am at loss.

Thanks for help.

Can nobody help me? I need realy your help.

Make sure you have file permissions on your server.
chmod -r 755 /place/of/files

I have no place for files on the server, the pdf file will be create on the fly.

Same problem. After ending server route looks like the client loses connection to server - all reactive variables become empty.
What should I do after sending response from server route to get back in context?

I solved this issue with reroute back after 200 ms. It works for me.