Closed pcolby closed 4 years ago
It appears to have resolved itself now.
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
Nothing else on console or anything :/
+1
The text in my broken pdf file : ERROR: No API conversion tokens available
cc @thomasdavis
I created a PDF file from the command line and I got the following:
xxd file.pdf 0000000: 4552 524f 523a 204e 6f20 4150 4920 636f ERROR: No API co 0000010: 6e76 6572 7369 6f6e 2074 6f6b 656e 7320 nversion tokens 0000020: 6176 6169 6c61 626c 65 available
Online, this is the same:
+1
The text in my broken pdf file : ERROR: No API conversion tokens available
Sorry everyone, I actually ran into some financial problems, getting this sorted asap! We should probably migrate off the service also...
@thomasdavis No worries, thanks for responding. Can we use the Gratipay for this? If we know what target needs to be reached, we could also do a fund raising drive. I'd love to find another alternative, but I'm not sure what better options exist.
@thomasdavis what about Heroku? Simple to deploy to.
@thomasdavis https://github.com/thomasdavis No worries, thanks for responding. Can we use the Gratipay for this? If we know what target needs to be reached, we could do a fund raising drive. I'd love to find another alternative, but I'm not sure what better options exist.
— Reply to this email directly or view it on GitHub https://github.com/jsonresume/resume-cli/issues/94#issuecomment-90251772.
@sebastialonso What actual code would run on Heroku? We have tried a few other libraries & apps, but none have good enough output quality. If you know of any other programs to suggest or want to try tweaking settings on some of the ones we have tried that would be great, here is the issue about PDF conversion code:: https://github.com/jsonresume/resume-cli/issues/72
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!
Would it make sense to do PDF conversion locally instead of using a paid service?
@elijahchancey See https://github.com/jsonresume/resume-cli/issues/72
what about asking the user to register in pdfcrown and then build a config file with his token? This way, each person would have 100 credits for free.
It would not be too crazy to build a service which runs a basic web framework + phantomJS on the cloud (certainly Heroku is an option). Each time a user wishes to generate a PDF you pass the HTML as a POST request to an endpoint. The service would then serve that HTML up for PhantomJS to take a snapshot of (maybe store the markup in redis or something). From there pass that generated PDF back to the user and remove it from the file system. Really your biggest overhead is the read/write/delete from the last part. Should be able to run well on a machine with 1gb of RAM with at least a few concurrent connections.
http://www.cloudatcost.com/ is always a good option for this type of thing. They have 50% off sales pretty often.
@howardroark Try phantomJS and see what you think of the PDF output quality. The issue is not finding a host, but which library/program to use for PDF generation.
Ok guys was finally able to get the pdf service paid up to scratch, thanks for the patience. We also have a budget to put a bounty on issues now, so maybe a proper pdf conversion module?
@thomasdavis Thanks for addressing the PDFCrowd issue!
It looks like there is still some problem, maybe the Heroku apps needs to be restarted? Here is the output from resume export foo.pdf
:
<!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>
Hrmm I've just restarted the server. Maybe give it another shot.
Ahh I'm getting the error too now.
In the meantime, you can mess with this script + node module I found that may help you.
npm install html-pdf
node html2pdf.js <path-and-filename-of-prev-generated-html-output-in-step-one> myresume.pdf
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' }
});
Can someone test https://github.com/jsonresume/registry-server and see if it has any errors running locally? Or try deploying it to Heroku and see if that shows any problems.
What is stopping client side generation being possible?
Please see https://github.com/jsonresume/resume-cli/issues/72 for discussion of client side PDF generation.
Gotcha. PDF sucks.
@thomasdavis could I offer up the services of https://docraptor.com instead? I think we could support this through some sort of community project. Our backend uses PrinceXML which was build from the ground up for PDF generation. Generally speaking, better results/more power than PhantomJS/wkhtmltopdf.
I'm getting this bug occuring again.
I found that the best work around was by @TimDaub suggesting using Chrome to view the print view of the HTML and save it to PDF.
There's also NightmareJS that I've been using with great success for headless testing that seems to also do PDF rendering.
Getting the "No API tokens" error with native PDF conversion. The browser print option with a more-compact theme works good enough today for a one-page resume (i still like the fleshed out HTML version for display). If we moving away from native conversion as in #72 or #94, why not drop it all together and provide documentation?
Ahh I will purchase some more tokens now in the mean time.
On Thu, Nov 19, 2015 at 1:48 PM, Eric Paul notifications@github.com wrote:
Getting the "No API tokens" error with native PDF conversion. The browser print option with a more-compact theme works good enough today for a one-page resume (i still like the fleshed out HTML version for display). If we moving away from native conversion as in #72 https://github.com/jsonresume/resume-cli/issues/72 or #94 https://github.com/jsonresume/resume-cli/issues/94, why not drop it all together and provide documentation?
— Reply to this email directly or view it on GitHub https://github.com/jsonresume/resume-cli/issues/94#issuecomment-157943135 .
Thomas Davis http://thomasdav.is
VP of Tech - Earbits - http://earbits.com Co-founder - Cdnjs - http://cdnjs.com Founder - Backbone Tutorials - http://backbonetutorials.com
@thomasdavis what about taking @JamesPaden's suggestion?
Getting "ERROR: No API conversion tokens available" for the past week or so (only just realized that by opening up the PDF to inspect contents). Would agree that a local conversion would be ideal
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.
@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.
@Ezibenroc Does the index.html
file look as expected? I was using a fork of the "flat" theme to omit website
. Try removing the -fork
part from this line ... https://github.com/howardroark/resume/blob/master/package.json#L6
That may help.
Any update?
Sorry guys, this one slipped through the cracks for me. It is an unpaid bill on pdfcrowd which I can't afford at the moment.
I originally set it up because it did a way better job at PDF conversion. But at this point I think I need to embed a conversion tool in the CLI. The problem being, it isn't so easy as others have pointed out.
It seems like we should add @howardroark solution to the cli tool, think you could link us some examples of output?
I think the trick would be finding wkhtmltopdf
binaries for each major system, hosting them, and then building an npm module that downloaded the correct one and sort of "wrapped" it.
So if it runs on Linux well enough I can move PDF conversion to the Theme server until we have cross platform local PDF export..
Or maybe give another free API a try? http://www.html2pdfrocket.com/ for example.
I have updated my template to include binaries for OSX. I may try my hand at a module that offers the wkhtmltopdf
binary to the node bin path. That way I can leave out the binaries and just count on npm install
to do everything.
Have you considered html-pdf
? It's quite good. Here I am using it to generate http://dbkaplun.com/resume.pdf from http://dbkaplun.com/resume.json automatically.
That is pretty slick! Certainly a better install process. Though for me I really enjoy how wkhtmltopdf preserves links. If phantomjs did that it would be awesome!
Aw man, I was creating my first json-resume for my girlfriend, and now I can't export to pdf and show her
@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.
Is there no hope the pdf export? I really love this project and the simplicity of it but the external transformation of html to pdf is just doesn't look good enough
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.
I installed cli. getting error while invoking clie
/usr/local/lib/node_modules/resume-cli/lib/export-resume/index.js:41
console.error(JSON Resume does not support the ${format} format
);
^
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.
Currently, for me, all PDF outputs contain just this text:
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.