Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Ability to customize downloaded PDF filename (instead of "generated.pdf"). Optional param. Bumped version according to semver.org #3

Merged
merged 1 commit into from

2 participants

@cbumgard

...omize downloaded name, defaults to generated.pdf. Bumped version to 1.1.0 (bumped minor version, reset patch version, since it is a backwards compatible API change - i.e. http://semver.org/)

@cbumgard cbumgard Allow passing in optional filename for sendHttpResponse callback to c…
…ustomize downloaded name, defaults to generated.pdf. Bumped version to 1.1.0 (bumped minor version, reset patch version, since it is a backwards compatible API change - i.e. http://semver.org/)
2bf8fdc
@pdfcrowd pdfcrowd merged commit a8e021f into pdfcrowd:master
@pdfcrowd
Owner

Thanks!

@cbumgard

My pleasure :) Could I ask you to do an 'npm publish' on the new version so I can update my package.json deps to point at 1.1.x? Thanks!

@pdfcrowd
Owner

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 2, 2013
  1. @cbumgard

    Allow passing in optional filename for sendHttpResponse callback to c…

    cbumgard authored
    …ustomize downloaded name, defaults to generated.pdf. Bumped version to 1.1.0 (bumped minor version, reset patch version, since it is a backwards compatible API change - i.e. http://semver.org/)
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +3 −2 lib/pdfcrowd.js
  2. +1 −1  package.json
View
5 lib/pdfcrowd.js
@@ -102,14 +102,15 @@ var saveToFile = function(fname) {
//
// Returns a callback object that sends the generated PDF in an HTTP response
//
-var sendHttpResponse = function(response, disposition) {
+var sendHttpResponse = function(response, disposition, fname) {
disposition = disposition || "attachment";
+ fname = fname || "generated.pdf";
return {
pdf: function(rstream) {
response.setHeader("Content-Type", "application/pdf");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Accept-Ranges", "none");
- response.setHeader("Content-Disposition", disposition + "; filename=\"generated.pdf\"");
+ response.setHeader("Content-Disposition", disposition + "; filename=\"" + fname + "\"");
rstream.pipe(response);
},
error: function(errMessage, statusCode) {
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "pdfcrowd",
- "version": "1.0.4",
+ "version": "1.1.0",
"repository": {
"type": "git",
"url": "git@github.com:pdfcrowd/node-pdfcrowd.git"
Something went wrong with that request. Please try again.