狂暴之心出装顺序我是新手求详细

狂暴之心出装

一脸懵逼 一脸懵逼
回答
  • ㄨ℉陳尒濺℅` ㄨ℉陳尒濺℅`

    展开全部/
    生成网页快照
    public class htmltoimg
    {
    private system.drawing.bitmap m_bitmap;private string m_url;private int m_browserwidth,m_browserheight,m_bodywidth,m_bodyheight,m_thumbnailwidth,m_thumbnailheight;public static system.drawing.bitmap gethtmltoimg(string url,int width,int height)
    {
    return gethtmltoimg(url,width,height,width,height,width,height);}
    public static system.drawing.bitmap gethtmltoimg(string url,int browserwidth,int browserheight,int bodywidth,int bodyheight)
    {
    return gethtmltoimg(url,browserwidth,browserheight,bodywidth,bodyheight,bodywidth,bodyheight);}
    public static system.drawing.bitmap gethtmltoimg(string url,int browserwidth,int browserheight,int bodywidth,int bodyheight,int thumbnailwidth,int thumbnailheight)
    {
    htmltoimg thumbnailgenerator=new htmltoimg(url,browserwidth,browserheight,bodywidth,bodyheight,thumbnailwidth,thumbnailheight);return thumbnailgenerator.generatehtmltoimgimage();}
    public static void gethtmltoimg(string url,string path,int browserwidth,int browserheight,int bodywidth,int bodyheight,int thumbnailwidth,int thumbnailheight)
    {
    htmltoimg thumbnailgenerator=new htmltoimg(url,browserwidth,browserheight,bodywidth,bodyheight,thumbnailwidth,thumbnailheight);system.drawing.bitmap bp=thumbnailgenerator.generatehtmltoimgimage();bp.s**e(path,system.drawing.imaging.imageformat.jpeg);}
    private htmltoimg(string url,int browserwidth,int browserheight,int bodywidth,int bodyheight,int thumbnailwidth,int thumbnailheight)
    {
    m_url=url;m_browserheight=browserheight;m_browserwidth=browserwidth;m_bodywidth=bodywidth;m_bodyheight=bodyheight;m_thumbnailwidth=thumbnailwidth;m_thumbnailheight=thumbnailheight;}
    private system.drawing.bitmap generatehtmltoimgimage()
    {
    system.threading.thread m_thread=new system.threading.thread(new system.threading.threadstart(_generatehtmltoimgimage));m_thread.setapartmentstate(system.threading.apartmentstate.sta);m_thread.start();m_thread.join();return m_bitmap;}
    private void_generatehtmltoimgimage()
    {
    system.windows.forms.webbrowser m_webbrowser=new system.windows.forms.webbrowser();m_webbrowser.scrollbarsenabled=false;m_webbrowser.n**igate(m_url);m_webbrowser.documentcompleted+new system.windows.forms.webbrowserdocumentcompletedeventhandler(webbrowser_documentcompleted);while(m_webbrowser.readystate!system.windows.forms.webbrowserreadystate.complete)
    system.windows.forms.application.doevents();m_webbrowser.d**pose();}
    private void webbrowser_documentcompleted(object sender,system.windows.forms.webbrowserdocumentcompletedeventargs e)
    {
    system.windows.forms.webbrowser m_webbrowser=(system.windows.forms.webbrowser)sender;m_webbrowser.clientsize=new system.drawing.size(th**.m_browserwidth,th**.m_browserheight);m_webbrowser.scrollbarsenabled=false;system.drawing.rectangle rec=new system.drawing.rectangle(0,0,m_bodywidth,m_bodyheight);m_bitmap=new system.drawing.bitmap(m_webbrowser.bounds.width,m_webbrowser.bounds.height);m_bitmap=new system.drawing.bitmap(rec.width,rec.height);m_webbrowser.bringtofront();m_webbrowser.drawtobitmap(m_bitmap,m_webbrowser.bounds);m_webbrowser.drawtobitmap(m_bitmap,rec);m_bitmap=(system.drawing.bitmap)m_bitmap.getthumbnailimage(m_thumbnailwidth,m_thumbnailheight,**,intptr.zero);}
    }
    网页生成pdf
    public class htmltopdf
    {
    public static void htmltopdfbyimg(string url,string path,int browserwidth,int browserheight,int bodywidth,int bodyheight,int thumbnailwidth,int thumbnailheight)
    {
    system.drawing.bitmap bmp=htmltoimg.gethtmltoimg(url,browserwidth,browserheight,bodywidth,bodyheight,thumbnailwidth,thumbnailheight);string fn=(guid.newguid().tostring().substring(0,8)+".jpg");if(path.lastindexof("\\")>-1)
    {
    fn=path.substring(0,path.lastindexof("\\"))+"\\"+fn;}
    bmp.s**e(fn,system.drawing.imaging.imageformat.jpeg);itextsharp.text.image im=itextsharp.text.image.getinstance(fn);itextsharp.text.rectangle rec=new itextsharp.text.rectangle(im.width,im.height);itextsharp.text.document doc=new itextsharp.text.document(rec,0,0,0,0);itextsharp.text.pdf.pdfwriter.getinstance(doc,new system.io.filestream(path,system.io.filemode.create));doc.open();doc.add(im);doc.close();bmp.d**pose();doc.d**pose();try
    {
    system.io.file.delete(fn);}
    catch { }
    }
    }
    [csharp]view plain copy
    protected void button1_click(object sender,eventargs e)
    {
    string names="orderform_"+request["o"]+".pdf;string paths=appdomain.currentdomain.relativesearchpath.replace("bin","")+"temp\\"+names;int h=j**hu+hangshu*27;htmltopdf.htmltopdfbyimg(request.url.absoluteuri+"&**print=true",paths,750,h+300,750,h,750,h);httpcontext.current.response.clear();httpcontext.current.response.buffer=true;httpcontext.current.response.addheader("content-type","x-msdownload");httpcontext.current.response.charset=system.text.encoding.utf8.headername;httpcontext.current.response.appendheader("content-d**position","attachment;filename="+system.web.httputility.urlencode(names,system.text.encoding.utf8));httpcontext.current.response.writefile(paths);}

类似问答
精品推荐

友情链接

友链互换QQ:

谷财 备案编号:蜀ICP备11019336号-3商务合作:235-677-2621

Copyright 2009-2020 Chengdu Sanzilewan Technology Co.,Ltd all rights reserve

抵制不良游戏 拒绝盗版游戏 注意自我保护 谨防受骗上当 适度游戏益脑 沉迷游戏伤身 合理安排时间 享受健康生活