ahmd0
ahmd0

Reputation: 17313

Printing of HTML markup with C++

I was curious if I can embed printing of HTML markup in my C++ application? Here's what I need:

  1. Ability to specify which printer to print to.
  2. Ability to change paper size.
  3. Ability to specify margins/gutter, etc.
  4. Ability to let end-user preview the result.

Upvotes: 1

Views: 1640

Answers (3)

gifnoc-gkp
gifnoc-gkp

Reputation: 1516

It would be easier to virtually print the HTML page to a PDF file using wkHTMLtoPDF C++ Library, and then print it.

Pros:

  • It allows you to keep a draft copy for future use.

Cons:

  • It's not a print-HTML-directly library

Upvotes: 3

franji1
franji1

Reputation: 3156

MFC has a CHtmlView class that is part of their Document/View architecture. Hence, you can create a rather simple MDI "Web Browser" in MFC pretty easily.

Upvotes: 1

Roel
Roel

Reputation: 19642

Have a look at this library: http://www.terrainformatica.com/htmlayout/ . It does everything you need, assuming you want to print the rendered html, and not syntax-highlighted html source code, which is not entirely clear from your question - but

Upvotes: 1

Related Questions