cesium-print 动态打印插件
Cesium 动态打印插件 cesium-print is a plugin for cesium printing
Usage
Include it in your code after importing npm, like:
npm install cesium-print -dev
复制代码
Use it like:
import CesiumPrint from "cesium-print";
复制代码
viewer = new Cesium.Viewer("cesiumContainer", {
contextOptions: {
id: "cesiumCanvas",//must
webgl: {
preserveDrawingBuffer: true
}
}
}
//打印cesium canvas dom
CesiumPrint.drawArea("cesiumCanvas", {
penColor: "yellow", //画笔颜色
strokeWidth: 1 //单位 px
})
.then(base64url => {
//base64url is images
//print drawArea dom
CesiumPrint.print(base64url);
})
.catch(error => {
console.error(error);
});
复制代码
You can submit the options object like:
//打印cesium canvas dom
CesiumPrint.drawArea("cesiumCanvas", {
penColor: "yellow", //画笔颜色
strokeWidth: 1 //单位 px
})
.then(base64url => {
//自定义打印(设置纸张大小,打印标题)
// 高 宽
// A0:1189mm * 841mm
// A1:841mm * 594mm
// A2:594mm * 420mm
// A3:420mm * 297mm
// A4:297mm * 210mm
// 页边距: 0.75 inch
// A1: 23.39x33.11 inch
// 打印机DPI:300DPI
// 屏幕DPI : 96DPI
// width = (23.39 - 0.75 * 2) * 96 = 2101 px
// height = (33.11 - 0.75 * 2)* 96 = 3034 px
// A4: 8.27x11.69 inch
// 打印机DPI:300DPI
// 屏幕DPI : 96DPI
// width = (8.27 - 0.75 * 2) * 96 = 650 px
// height = (11.69 - 0.75 * 2)* 96 = 978 px
// 所以,当<table> 的width=650px, height=978px时,用IE 打印时,刚好能打印一页的A4纸.
// //a1横向打印尺寸
// var a1 = { width: "3034", height: "2101" };
// //a4横向打印尺寸
var a4 = { width: "978", height: "650" };
let printOptions = {
title: "打印标题(print title)",
width: a4.width,
height: a4.height,
fontSize: "30",
downLoadEnable: true //是否下载打印文件
};
CesiumPrint.print(base64url, printOptions);
});
})
.catch(error => {
console.error(error);
});
复制代码
Currently this plugin supports the following options:
penColor
- Default:
red - Acceptable-Values: color string
- Function Desc: pen Color
strokeWidth
- Default:
1 - Acceptable-Values: number
- Function: stroke width ( unit px )
width
- Default:
978 - Acceptable-Values: number
- Function: print width ( unit px )
height
- Default:
650, creates a hidden iframe if no-vaild iframe selector is passed - Acceptable-Values: number
- Function: print width ( unit px )
fontSize
- Default:
32 - Acceptable-Values: number
- Function: print title font size ( unit px )
downLoadEnable
- Default:
true - Acceptable-Values: Boolean
- Function: down load print file enable
title
- Default:
print, uses the host page title - Acceptable-Values: Any single-line string
- Function: To change the printed title
Browsers
- Google Chrome - v ...
- Firefox - v ...
License
....
Demo
Code Demo
Other Cesium Plugin
Like our work? Get in touch 51844712@qq.com!
cesium-print 动态打印插件的更多相关文章
- Android插件简介
/** * @actor Steffen.D * @time 2015.02.06 * @blog http://www.cnblogs.com/steffen */ Android插件简介 Andr ...
- python3下安装Selenium插件和驱动
import sysimport osimport shutilimport time os.system('pip install selenium') file_name="IEDriv ...
- print.js继承原有样式
npm install --save print-js import Print from 'print-js' 调用print.js插件 Print({ printable: 'printJS-fo ...
- 转:Cesium 和 Webpack
原文地址:https://www.jianshu.com/p/85917bcc023f 注意:webpack 和 webpack-cli 的安装参考 https://www.cnblogs.com/m ...
- Cesium官方教程13--Cesium和Webpack
原文地址:https://cesiumjs.org/tutorials/cesium-and-webpack/ Cesium 和 Webpack Webpack是非常强大非常流行的JavaScript ...
- Cesium参考资源
Reference resources cesium官网 cesium 下载 cesium官方文档 APIs cesium-workshop github cesium 官方示例 cesium git ...
- Zabbix监控系统
前言: 一个初略自动化运维平台,应该实现以下3个层面自动化: 1.操作系统层面自动化 如果想要万台服务器共舞,没有操作系统这个舞台还怎么舞? 1.1:物理环境: OS预备自动安装(Pxe/KickSt ...
- jquery 网页局部打印总结
最近开发过程中遇到了js局部打印的功能,在网上找相关的资料,最终找到了juery.jqprint-0.3.js 和jquery.PrintArea.js两种. 最初使用的是jquery.jqprint ...
- Web打印连续的表格,自动根据行高分页
拿到这个需求,我已经蛋碎了一地,经过N天的攻克,终于是把它搞定了,只是不知道会不会在某种情况下出现BUG.表示我心虚没有敢做太多的测试.... ---------------------------- ...
随机推荐
- linux广播
linux广播 // 发送端 #include <stdio.h> #include <unistd.h> #include <sys/types.h> #incl ...
- [LeetCode] 107. Binary Tree Level Order Traversal II 二叉树层序遍历 II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left ...
- 第07组 Beta冲刺(4/4)
队名:秃头小队 组长博客 作业博客 组长徐俊杰 过去两天完成的任务:学习了很多东西 Github签入记录 接下来的计划:继续学习 还剩下哪些任务:后端部分 燃尽图 遇到的困难:自己太菜了 收获和疑问: ...
- springcloud学习的坑
一:启动Euerka作为提供者或者消费者时,启动失败报:Process finished with exit code 0 Unregistering application EUREKA-SERVI ...
- Active Objects模式
实现的思路是,通过代理将方法的调用转变为向阻塞队列中添加一个请求,由一个线程取出请求后执行实际的方法,然后将结果设置到Future中 这里用到了代理模式,Future模式 /************* ...
- Prometheus入门到放弃(7)之redis_exporter部署
redis监控,prometheus需要使用redis_exporter客户端. 这里我们采用docker方式部署,既可以部署在redis所在服务器,也可以部署在其他机器: docker镜像地址:ht ...
- MySQL中主键id不连贯重置处理办法
MySQL中有时候会出现主键字段不连续,或者顺序乱了,想重置从1开始自增,下面处理方法 先删除原有主键,再新增新主键字段就好了 #删除原有自增主键 ALTER TABLE appraiser_info ...
- Java -- 最简单的认识重载
定义 方法的名称相同,参数个数或类型不同的时候就成为方法重载. 示例 编写一个两个数相加的方法: public class hello{ public static void main(String ...
- Appium_Page object设计模式
Page object设计模式思维,把app按页面去划分,一个页面就是一个page对象 每个页面的元素集中管理.页面上按钮操作方法单独封装 # __author__ = " Caric Le ...
- Centos7 在线安装开发环境 jdk1.8+mysql+tomcat
写在最前 刚刚开始接触Linux,并折腾着在服务器上部署自己的项目,当然作为一个后端开发人员,必不可少的东西肯定是 JDK Mysql Tomcat容器 每天记录一天,每天进步一点点~~ 1.更新系统 ...