Thomas Jomphe
Thomas Jomphe

Reputation: 117

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.

Upvotes: 0

Views: 386

Answers (1)

Ibrahem Uwk
Ibrahem Uwk

Reputation: 135

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

Upvotes: 1

Related Questions