bhofmei / jbplugin-screenshot

JBrowse plugin that adds button which uses phantomJS to take browser screenshot
Other
9 stars 3 forks source link

PDF rendering slightly off #8

Closed cmdcolin closed 7 years ago

cmdcolin commented 7 years ago

Hi there! I was experimenting with PDF rendering recently and I noticed for example that oftentimes the tracklist has a weird gap around it

For example with this URL there is a gap between the browser and the tracklist:

https://phantomjscloud.com/api/browser/v2/a-demo-key-with-low-quota-per-ip-address/?request={url:%22http://jbrowse.org/code/JBrowse-1.11.6/?data=sample_data%2Fjson%2Fvolvox%26loc=ctgA%3A796..1615%26tracks=DNA%26highlight=%26screenshot=p20o1r0n1u1b1m111s000000z1%22,renderType:%22PDF%22,renderSettings:{zoomFactor:1,quality:70,pdfOptions:{format:%22letter%22,orientation:%22landscape%22,footer:null},viewport:{width:1800,height:1200}}}

But with this URL the gap goes away:

https://phantomjscloud.com/api/browser/v2/a-demo-key-with-low-quota-per-ip-address/?request={url:%22http://jbrowse.org/code/JBrowse-1.11.6/?data=sample_data%2Fjson%2Fvolvox%26loc=ctgA%3A796..1415%26tracks=DNA%26highlight=%26screenshot=p20o1r0n1u1b1m111s000000z1%22,renderType:%22PDF%22,renderSettings:{zoomFactor:1,quality:70,pdfOptions:{footer:null}}}

I was considering the possibility that this could be an issue with jbrowse core, but given that changing the rendering settings alleviates the issue somewhat, do you think this plugin would benefit from altering the settings passed to phantomjs?

cmdcolin commented 7 years ago

Note that this happens with default phantomjs too, so this isn't really a bug exclusive to this plugin.

It just seems that some combination of viewport and pdf page size makes it happen

bhofmei commented 7 years ago

Thanks for reaching out.

I’ve noticed this problem in the past. The track list doesn’t play nice with the PDF rendering. I suspect it has to do with the CSS for the track list, but I haven’t confirmed this. The tracklist is specified to take up 25% of the width, which it does in both images. But in the image with the gap, the scale of the track list content (scaled by viewport size) is less than 25% width, so you see the gap. In the image without the gap, you don’t specify the viewport so it doesn’t need to scale. Also note that in the image without the gap, the page is portrait and the screenshot image is square.

To alleviate this problem, I have the plugin automatically uncheck the “Show track list” check box when the PDF radio button is selected. You would have had to then recheck the “Show track list” check box to see it in the final image. Me personally, I rarely want the track list showing since I use screenshots to show regions of the genome and the track list just takes up unnecessary space. And if I did require the track list, it doesn’t show the gap with PNG and JPG (don’t ask me to explain that). I would rather have the flexibility to specify the viewport.

If you have any suggestions, I’m all ears! But at this point, I haven’t come up with anything better.

On Mar 13, 2017, at 4:37 PM, Colin Diesh notifications@github.com wrote:

Note that this happens with default phantomjs too, so this isn't really a bug exclusive to this plugin.

It just seems that some combination of viewport and pdf page size makes it happen

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bhofmei/jbplugin-screenshot/issues/8#issuecomment-286235654, or mute the thread https://github.com/notifications/unsubscribe-auth/APWCOgGXCILKpaeuCeQWFXqWDprTNILBks5rlakAgaJpZM4Mbwgl.

cmdcolin commented 7 years ago

I just noticed the thing where tracklist gets turned off when PDF selected, seems good!

Ill see if there might be a fix that can be added to jbrowse core could fix it properly!

cmdcolin commented 7 years ago

Probably just close this issue for now :)