node-chimera icon indicating copy to clipboard operation
node-chimera copied to clipboard

PDF rendering

Open underbyte opened this issue 12 years ago • 9 comments

The capture function does a nice job of rendering a pdf but is their a way to set the viewport, orientation, and margin? If not would this be possible with Chimera?

underbyte avatar Jan 30 '13 05:01 underbyte

I could add some stuff to alter the viewport, but I'm not sure if I could control the pdf viewer. It's probably using whatever pdf plugin your browser would be using, which probably has it's own set of controls. Are you doing this on linux or mac?

deanmao avatar Jan 30 '13 05:01 deanmao

I'm doing this on linux. I was just wondering cause phantomjs is about to set those parameters, so I was hoping chimera could do the same.

underbyte avatar Jan 30 '13 05:01 underbyte

On phantom you can set the viewport, but I don't think you could rotate or zoom the pdf. Those sound like pdf controls.

deanmao avatar Jan 30 '13 05:01 deanmao

In phantomjs setting the paperSize and viewportSize objects controls how the pdf will look once rendered. It doesn't give you free control of rotation, just landscape or portrait. https://github.com/ariya/phantomjs/wiki/API-Reference

No idea how phantomjs is doing through Qt but some of the code is in webpage.cpp. https://github.com/ariya/phantomjs/blob/master/src/webpage.cpp

underbyte avatar Jan 30 '13 06:01 underbyte

Yeah, it's just setting the viewport in the code, it's not doing anything special like pdf controls. The paper size thing is just a fancy viewport control where you specify the paper type and it converts that into a pixel dimension, but you could just specify the pixel dimension directly too. At the moment chimera is just hardcoded to a 1024x768 viewport.

deanmao avatar Jan 30 '13 06:01 deanmao

+1 on allowing setting custom viewport size, please.

kristjanjansen avatar Jan 31 '13 19:01 kristjanjansen

+1

xMythicx avatar May 23 '13 01:05 xMythicx

+1

pdelanauze avatar May 24 '13 06:05 pdelanauze

@guber @kristjanjansen @xMythicx @pdelanauze Changing the viewport when printing for PDF will not affect the PDF output as I've found out recently. However you can adjust the QPrinter configuration like the renderPdf method in https://github.com/ariya/phantomjs/blob/master/src/webpage.cpp#L1065

cjpartridgeb avatar Jun 03 '13 01:06 cjpartridgeb