c# - ABCpdf not applying inline css styles -
in aspx page have script following css
<style type="text/css"> .subcontainer{margin: 0 auto; padding-top: 20px} .hide-val{display:none;} </style>
in browser page loads ok, div class hide-val
not displayed when use addimageurl styles not being applied.
doc thedoc2 = new doc(); thedoc2.htmloptions.usescript = true; thedoc2.htmloptions.media = mediatype.print; thedoc2.htmloptions.initialwidth = 1048; //for multiple page thedoc2.rect.inset(10, 30); thedoc2.page = thedoc2.addpage(); int theid2; theid2 = thedoc2.addimageurl(urltohtmlpage); while (true) { thedoc2.framerect(); // add black border if (!thedoc2.chainable(theid2)) break; thedoc2.page = thedoc2.addpage(); theid2 = thedoc2.addimagetochain(theid2); } (int = 1; <= thedoc2.pagecount; i++) { thedoc2.pagenumber = i; thedoc2.flatten(); } //end multipage thedoc2.save(httpcontext.current.server.mappath("htmlimport.pdf")); thedoc2.clear();
i have seen many questions haven't found answer
how can add css style in doc?
since specified thedoc2.htmloptions.media = mediatype.print;
, have tried marking css @media print
?
like so:
<style type="text/css"> @media print { .subcontainer{margin: 0 auto; padding-top: 20px} .hide-val{display:none;} } </style>
alternatively, take out line thedoc2.htmloptions.media = mediatype.print;
i haven't verified this, it's worth shot.
Comments
Post a Comment