Skip to content

Instantly share code, notes, and snippets.

@xk
Created March 28, 2012 11:18
Show Gist options
  • Save xk/2225501 to your computer and use it in GitHub Desktop.
Save xk/2225501 to your computer and use it in GitHub Desktop.
doc.rotate(90) fails
var PDFDocument= require('pdfkit');
var doc= new PDFDocument();
doc.save();
doc.x= doc.pages[0].width/2;
doc.y= doc.pages[0].height/2;
doc.fontSize(30);
doc.rotate(89.9, {origin: [doc.x, doc.y]});
doc.text('OK, GOOD');
doc.restore();
doc.save();
doc.x= doc.pages[0].width/2;
doc.y= doc.pages[0].height/2;
doc.fontSize(30);
doc.rotate(90, {origin: [doc.x, doc.y]});
doc.text('FAILURE');
doc.restore();
doc.write('test.pdf');
require('child_process').exec('open test.pdf');
@LukyVj
Copy link

LukyVj commented Jan 5, 2017

Seems like the doc.rotate(90, {origin: [doc.x, doc.y]}); doesn't fail anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment