pixelcog / gmail-to-pdf

A Google Apps Script library for converting Gmail messages to PDFs for easy archival.
http://bit.ly/1CsBl8U
122 stars 38 forks source link

[GmailUtils.gs] Line Of Text Bisected Horizontally In Generated PDF #2

Open PaulWGraham opened 9 years ago

PaulWGraham commented 9 years ago

Sometime when creating PDFs using messageToPdf(messages,{embedAvatar:false}) the PDF generated contains lines of text that are bisected horizontally (see attached screenshot) and split between two pages in the PDF.

Note:

Removing the body{padding:0 10px;min-width:' + opts.width + 'px;-webkit-print-color-adjust: exact;} CSS declarations seems to prevent this issue (but obviously at a cost).

screen shot 2015-02-17 at 5 46 23 pm

mikegreiling commented 9 years ago

I'm not sure the line you removed would have anything to do with the bisection you are talking about, though altering the default width and padding may solve the problem by accident.

You may be able to solve the problem through careful injection of

element {
  page-break-inside: avoid;
}

...but I'd need to play around these values to find the best practice. Simply applying this style to * may break some designs.

aziz-boudi4 commented 8 years ago

I have the same issue, some of my generated PDFs get bisected horizontally.

screen shot 2016-03-31 at 4 02 38 pm