diff --git a/Changelog.md b/Changelog.md index 8ce23f6..ee25db9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +0.2.0 +===== +- Support remote images in html template + + 0.1.3 ===== - Update phantomjs node module dependency, some cdn changed diff --git a/lib/scripts/pdf_a4_portrait.coffee b/lib/scripts/pdf_a4_portrait.coffee index 88034b2..7f55d6d 100755 --- a/lib/scripts/pdf_a4_portrait.coffee +++ b/lib/scripts/pdf_a4_portrait.coffee @@ -56,24 +56,23 @@ else page.paperSize = paperSize +page.onLoadFinished = (status) -> + # Output to parent process + fileOptions = + type: options.type || 'pdf' + quality: options.quality || 75 + # Option 1: Output file to stdout + # Not working in Ubuntu 12.04 (at least not in my environment) + if options.buffer + page.render('/dev/stdout', fileOptions) -# Output to parent process -fileOptions = - type: options.type || 'pdf' - quality: options.quality || 75 -# Option 1: Output file to stdout -# Not working in Ubuntu 12.04 (at least not in my environment) -if options.buffer - page.render('/dev/stdout', fileOptions) - - -# Option 2: Output filename to stdout -else - filename = options.filename || ("#{options.directory || '/tmp'}/html-pdf-#{sys.pid}-#{size}.#{fileOptions.type}") - page.render(filename, fileOptions) - sys.stdout.write(filename) + # Option 2: Output filename to stdout + else + filename = options.filename || ("#{options.directory || '/tmp'}/html-pdf-#{sys.pid}-#{size}.#{fileOptions.type}") + page.render(filename, fileOptions) + sys.stdout.write(filename) -phantom.exit(0) + phantom.exit(0) diff --git a/package.json b/package.json index 5a83ac6..f2fa386 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-pdf", - "version": "0.1.3", + "version": "0.2.0", "description": "HTML to PDF converter that uses phantomjs", "main": "index.js", "directories": { diff --git a/test/businesscard.html b/test/businesscard.html index a9b0463..25b5bb1 100644 --- a/test/businesscard.html +++ b/test/businesscard.html @@ -22,17 +22,46 @@ } .group { - margin-top: 6mm; + margin-top: 3mm; } .line { color: white; position: relative; } + + .ghost { + position: relative; + text-align: center; + -webkit-transform: scale(0.6); + } + + .ghost .body { + z-index: 1; + position: relative; + height: 176px; + width: 125px; + } + + .ghost .eyes { + z-index: 10; + position: absolute; + left: 50%; + margin-left: -22px; + top: 25%; + width: 44px; + height: 25px; + background: url('http://static.suitart.com/templates/eyes.gif'); + } +
+