resume-cli: PDF output currently broken

Currently, for me, all PDF outputs contain just this text:

<!DOCTYPE html>
    <html>
    <head>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <style type="text/css">
        html, body, iframe { margin: 0; padding: 0; height: 100%; }
        iframe { display: block; width: 100%; border: none; }
      </style>
    <title>Application Error</title>
    </head>
    <body>
      <iframe src="//s3.amazonaws.com/heroku_pages/error.html">
        <p>Application Error</p>
      </iframe>
    </body>
    </html

This is regardless of the theme I use, and for a JSON document that hasn’t changed for days, and was working just a couple of hours ago.

I’m guessing whatever online service jsonresume-cli uses in the background for PDF conversion is currently broken, but I’m not sure where else to report it.

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 49 (18 by maintainers)

Most upvoted comments

I run https://www.api2pdf.com and I would be happy to give you guys free credit so that you can re-enable your pdf export feature. Just let me know.

For those looking for a workaround, open your CV in google chrome and press Ctrl + P for “print”, and then set “Save as PDF” as the destination. Works great!

Or maybe give another free API a try? http://www.html2pdfrocket.com/ for example.

If anyone is curious I have made a little build process with “npm scripts”. It first builds as html file with resume-cli, then a pdf with wkhtmltopdf, and finally a png with imagemagick (for the README.md file). I’m on OSX and the install of imagemagick and wkhtmltopdf is very simple… https://github.com/howardroark/resume

I really like wkhtmltopdf because it preserves links and offers a nice looking PDF assuming the template has a good responsive layout.

In theory a binary for each of those two tools could be downloaded to match the architecture and used as an npm module.

In the meantime, you can mess with this script + node module I found that may help you.

  1. First output to your resume.json to HTML with resume-cli
  2. npm install html-pdf
  3. Then create a file called html2pdf.js, and have this as it’s contents (see below)
  4. Use it like this: node html2pdf.js <path-and-filename-of-prev-generated-html-output-in-step-one> myresume.pdf
  5. Fiddle with the options object to get the outputted PDF to look nice. YMMV.
var fs = require('fs');
var pdf = require('html-pdf');

var args = process.argv;
var htmlfile = args[2];
var pdffile = args[3];

if(htmlfile === undefined || pdffile === undefined) {
    console.error('You must supply a html filename, and then a PDF filename.');
    process.exit();
}

var html = fs.readFileSync(htmlfile, 'utf8')
var options = { filename: pdffile, format: 'Letter' };

pdf.create(html, options).toFile(function(err, res) {
  if (err) return console.log(err);
  console.log(res); // { filename: '/tmp/html-pdf-8ymPV.pdf' }
});

@thomasdavis you mention pdfcrowd so what about adding the ability to provide a custom API token using the cli? Looking at pdfcrowd, they offer a trial with 100 tokens so each of us can just register and get those 100 conversions for ourselves.

Aw man, I was creating my first json-resume for my girlfriend, and now I can’t export to pdf and show her

@howardroark I tried to run wkhtmltopdf, but I got a bad looking pdf: resume.pdf

Any hint on how to produce a correct output? Note that I got similar bad-looking output if I open the html file in a browser and then print it. The html itself is rendered well in firefox and chrome.

Would it make sense to do PDF conversion locally instead of using a paid service?

I’m having an issue with pdf export

The command resume export resume.pdf seems to work correctly, and even ‘creates’ a pdf file. When I try to open it, I get the following Documen Viewer error

Unable to open document

File type HTML document (text/html) is not supported

Nothing else on console or anything 😕