简体   繁体   中英

DinkToPdf - HTML div on one pdf page

I generate PDF from HTML with DinkToPdf, but I have a problem with some div , because half of it is in one page and second half is on another page. Sometimes only one word is on the next page.

Is there any solution how to set that whole div will be on the same page? The best would be through html/css. For example if there is enough space for whole div , it will be on the same page where the text continue. If there is not enough space, the whole div will be on the new page.

I solved it by myself. The css for the div should have this:

page-break-inside: avoid;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM