gt icon indicating copy to clipboard operation
gt copied to clipboard

gtsave to pdf results in long whitespace

Open ldiao opened this issue 3 years ago • 5 comments

I found that while writing tables to pdf using gtsave, the resulting pdf has a long stretch of white space following the table (seems to be correlated with size of table--the longer the table, the longer the trailing whitespace).

I found that using webshot I was able to address this particular problem by flagging the webshot option cliprect = 'viewport' and setting zoom = 1 in file gt/export.R at line 204.

I didn't find this issue reported by anyone else, so maybe it's specific to me but I found it very reproducible.

ldiao avatar Mar 09 '21 01:03 ldiao

Thank you! I had the same issue, I could clip the white space by adding zoom = 1 in gtsave, e.g. gtsave("epj.pdf", zoom = 1)

gkaramanis avatar Mar 12 '21 13:03 gkaramanis

@ldiao thank you so much for discovering the right setting. I will take a look at this again and set the proper default for PDF.

rich-iannone avatar Mar 15 '21 00:03 rich-iannone

PDF export via webshot simply uses an 8.5 x 11'' page and the whitespace you're getting is simply the rest of the page. Because of this there's nothing really to fix here.

rich-iannone avatar Jul 06 '21 19:07 rich-iannone

Even with zoom = 1, there white space on both the right and left side are way too long. Any other way to reduce the margin on right/left?

abiyug avatar Feb 21 '22 10:02 abiyug

I agree that PDF export is really suboptimal. I'd like the cropbox to be set similarly to the PNG export. Unfortunately this is not really possible with just webshot but seems more doable with the webshot2 and chromote packages. I'll do some work to add support for webshot2 and I hope to get PDF export in a better place.

rich-iannone avatar Feb 21 '22 17:02 rich-iannone