Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to Print HTML content...

How to Print HTML content...

Scheduled Pinned Locked Moved ASP.NET
helpquestionhtmlcomtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cnu angajala
    wrote on last edited by
    #1

    I have HTML content/text in a string variable and i want to print that (which looks like the one that appear on the browser). I found the below code in Code project only and i used the same: using HtmlPrinter; HtmlPrinter.HtmlPrinter hpobj = new HtmlPrinter.HtmlPrinter(); hpobj.PrintHtml(txtString.Text,true); But it is not workin for me. It is giving the following error: "ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment." How can i fix this bug? What did i miss here? Any work arounds please... Really appreciable if you can help me...

    Srini Hyderabad

    S 1 Reply Last reply
    0
    • C cnu angajala

      I have HTML content/text in a string variable and i want to print that (which looks like the one that appear on the browser). I found the below code in Code project only and i used the same: using HtmlPrinter; HtmlPrinter.HtmlPrinter hpobj = new HtmlPrinter.HtmlPrinter(); hpobj.PrintHtml(txtString.Text,true); But it is not workin for me. It is giving the following error: "ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment." How can i fix this bug? What did i miss here? Any work arounds please... Really appreciable if you can help me...

      Srini Hyderabad

      S Offline
      S Offline
      Sams Den
      wrote on last edited by
      #2

      Hi, Why don't you try using DHTMLEditClass and set the DocumentHTML property with the HTML text you are having. You can then make use of PrintDocument method and pass 1 as a ref parameter to show the print dialog. You can get some help from MSDN as well. Hope it solves all your issues. Thanks Sameer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups