当前位置: 首页 > news >正文

报表打印网络按比例打印网络图片

报表打印网络按比例打印网络图片

1, 读取图片

static container SML_ImgUrl2Bitmap(str  imgUrl,str newfileName = 'axTmpImgName1111')
{
    System.Net.HttpWebRequest   httpRequest  = null;
    System.Net.HttpWebResponse  httpResponse = null;

    CLRObject                   clro         = null;
    System.IO.Stream                stream;
    System.IO.StreamReader          reader;
    System.Drawing.Image            webImage ;
    BinData                         bidData=new BinData();
    Bitmap      Bitmap;
    str         saveFilePath;
    str         filepath, filename, fileExt;
    real         height,width;
   ;

    [filepath, filename, fileExt] = fileNameSplit(imgUrl);
    filePath= WinAPI::getTempPath();
    filename= newfileName;

    new InteropPermission(InteropKind::ClrInterop).assert();
    try {
        clro         = System.Net.WebRequest::Create(imgUrl);
        httpRequest  = clro;
        httpResponse = httpRequest.GetResponse();
        stream          = httpResponse.GetResponseStream();
        reader          = new System.IO.StreamReader(stream);
        webImage = System.Drawing.Image::FromStream(stream);
        saveFilePath = filePath+newfileName+fileExt;
        webImage.Save(saveFilePath);
        bidData.loadFile(saveFilePath);
        Bitmap =  bidData.getData();
        height = webImage.get_Height();
        width  = webImage.get_Width();
} catch (Exception::CLRError) { return [Bitmap,0,0]; } return [Bitmap,height,width]; }

2, 按比例显示图片,A4纸,纵向打印

void initProdImg()
{

    InventParameters    InventParameters;
str imgUrl;
#define.PicMaxWidth(18) // 允许图片最大宽度 #define.PicMaxHeight(8) // 允许图片最大高度 container scaleSize( int currW, int currH){ real maxW = #PicMaxWidth,maxH=#PicMaxHeight; real ratio = currH / currW; if( currH<= 144) maxH = 3; else if( currH<= 192) maxH = 4; else if( currH<= 240) maxH = 5; else if( currH<= 288) maxH = 6; if(currW >= maxW){ currW = maxW; currH = currW * ratio; } if(currH >= maxH){ currH = maxH; currW = currH / ratio; } return [currW, currH]; } void resetH(int currH){ ctrItemImg.height( currH,Units::cm); } void resetW(int currW){ ctrItemImg.width( currW,Units::cm); } ; InventParameters = InventParameters::find(); imgUrl = InventParameters.SML_InventImgUrl + curProdTable.sml_InventTableExt().SML_InventImgUrl; try { [prodImg,imgHeight,imgWidth] = SML_ImgUrl2Bitmap( imgUrl); if( !imgHeight || !imgWidth) { resetH(0); return; } else { [imgWidth,imgHeight] = scaleSize( imgWidth,imgHeight); resetH (imgHeight); resetW (imgWidth); ctrItemImg.resizeBitmap( true);// 允许图片按控件尺寸缩放。 } } catch(Exception::CLRError) { } }

 

  

posted on 2015-06-16 14:10 szsunny 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/sxypeace/p/4580641.html

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • Nim教程【十一】
  • 表达式 - PHP手册笔记
  • winzip15.0许可证
  • 云平台现有问题
  • 基于一个公网ip实现多主机上网
  • ffmpeg中swscale 的用法
  • 【吾日三省吾身】2015.6.20-涅槃行动第三十三天
  • Python套接字编程(1)——socket模块与套接字编程
  • 详解java Final关键字
  • pthread_t定义结构
  • 魔方阵
  • 写给努力坚持自学LINUX的自己
  • 如何开机就启动node.js程序
  • Atlas+Keepalived系列二:管理Atlas
  • mongodb 基础操作(一)
  • 【React系列】如何构建React应用程序
  • Angular 响应式表单之下拉框
  • Create React App 使用
  • express如何解决request entity too large问题
  • Javascript弹出层-初探
  • JavaScript设计模式系列一:工厂模式
  • linux安装openssl、swoole等扩展的具体步骤
  • Netty 框架总结「ChannelHandler 及 EventLoop」
  • PHP那些事儿
  • Python3爬取英雄联盟英雄皮肤大图
  • Rancher如何对接Ceph-RBD块存储
  • RedisSerializer之JdkSerializationRedisSerializer分析
  • Redis提升并发能力 | 从0开始构建SpringCloud微服务(2)
  • VUE es6技巧写法(持续更新中~~~)
  • 从 Android Sample ApiDemos 中学习 android.animation API 的用法
  • 从零搭建Koa2 Server
  • 干货 | 以太坊Mist负责人教你建立无服务器应用
  • 观察者模式实现非直接耦合
  • 基于Vue2全家桶的移动端AppDEMO实现
  • 使用 Docker 部署 Spring Boot项目
  • 手机端车牌号码键盘的vue组件
  • 腾讯视频格式如何转换成mp4 将下载的qlv文件转换成mp4的方法
  • 小程序开发之路(一)
  • 译米田引理
  • 支付宝花15年解决的这个问题,顶得上做出十个支付宝 ...
  • ​LeetCode解法汇总307. 区域和检索 - 数组可修改
  • ​一、什么是射频识别?二、射频识别系统组成及工作原理三、射频识别系统分类四、RFID与物联网​
  • # Panda3d 碰撞检测系统介绍
  • #android不同版本废弃api,新api。
  • #我与Java虚拟机的故事#连载02:“小蓝”陪伴的日日夜夜
  • (1)常见O(n^2)排序算法解析
  • (2)MFC+openGL单文档框架glFrame
  • (3)nginx 配置(nginx.conf)
  • (function(){})()的分步解析
  • (Redis使用系列) Springboot 使用redis实现接口幂等性拦截 十一
  • (SpringBoot)第二章:Spring创建和使用
  • (附源码)springboot电竞专题网站 毕业设计 641314
  • (一)使用IDEA创建Maven项目和Maven使用入门(配图详解)
  • (转)socket Aio demo
  • (转)visual stdio 书签功能介绍