简体   繁体   中英

HTML page to PDF with automatic height

I have an HTML page that I need to convert to PDF with C#, and I can't find how to make sure my PDF have exactly a width of 80mm and an automatic height (depending of content of the page). The HTML file is a receipt.

I have tried many libraries, but can't find the optimal solution.

Thanks.

You can try frindly print as pdf and add spacific print style like this

/* override styles when printing */
@media print {

  body {
    /* body styles when printing */
  }

}

You can take a look at this

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