TJkrusinski/NodePDF

Error when parsing json options in Windows

Opened this issue · 0 comments

It seems that there is a problem when parsing options at Windows 8;

I'm having this problem at line 18 in render.js, the string with the options come without quotes, so JSON cant parse.

Thats what its trying to execute:

phantomjs  C:\\Publix\\Dev\\node_modules\\nodepdf/render.js http://yahoo.com yahoo.pdf "{'viewportSize':{'width':2880,'height':1440},'paperSize':{'format':'A4','orientation':'portrait','margin':{'top':'1cm','right':'1cm','bottom':'1cm','left':'1cm'}},'zoomFactor':1,'args':'','captureDelay':400}"

But then the argument goes to render.js there is no quotes:

{viewportSize:{width:2880,height:1440},paperSize:{format:A4,orientation:portrait,margin:{top:1cm,right:1cm,bottom:1cm,left:1cm}},zoomFactor:1,args:,captureDelay:400}

I made some tests, the correct json string should be escaped with "":

phantomjs  C:\\Publix\\Dev\\node_modules\\nodepdf/render.js http://yahoo.com yahoo.pdf "{\"viewportSize\":{\"width\":2880,\"height\":1440},\"paperSize\":{\"format\":\"A4\",\"orientation\":\"portrait\",\"margin\":{\"top\":\"1cm\",\"right\":\"1cm\",\"bottom\":\"1cm\",\"left\":\"1cm\"}},\"zoomFactor\":1,\"args\":\"\",\"captureDelay\":400}"