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.表示我心虚没有敢做太多的测试.... ---------------------------- ...
随机推荐
- LeetCode_437. Path Sum III
437. Path Sum III Easy You are given a binary tree in which each node contains an integer value. Fin ...
- kubernetes-subpath用法(把文件挂载在已存在的目录下,不覆盖原目录)
以ngxin的配置文件为例子: nginx-deployment.yaml : apiVersion: v1 kind: ConfigMap metadata: name: nginx-cm data ...
- springboot实战日记(一)数据库基本信息
摘要:基于spring boot的后端实现,开发一个微信小程序点餐系统,主要是写写思路和遇到的问题以及分享读到的好文章. 项目分析: 1.角色划分,就是开有什么人使用这个系统,买家(手机端),卖家(p ...
- 自动化运维工具之SaltStack简介与安装
1.SaltStack简介 官方网址:http://www.saltstack.com官方文档:http://docs.saltstack.comGitHub:https:github.com/sal ...
- mybatis 一对一 一对多 多对多
一对一 一对多 多对多
- Mysql数据库索引IS NUll ,IS NOT NUll ,!= 是否走索引
声明在前面 总结就是 不能单纯说 走和不走,需要看数据库版本,数据量等 ,希望不要引起大家的误会,也不要被标题党误导了. 1 数据库版本: 2 建表语句 CREATE TABLE s1 ( id IN ...
- windows10环境下的RabbitMQ使用_笔记
使用默认账号:guest/guest登录http://localhost:15672/#/进去,添加一个新用户(Administrator权限),并设置其Permission 新建两个控制台程序 安装 ...
- .NET母版页实例(UI页面)
全文注释: 1.<!DOCTYPE>声明位于文档中的最前的位置,处于<html>标签之前. 2.此标签可告知浏览器文档使用哪种HTML或XHTML规范 3.<!DOCTY ...
- Asp.Net进阶/值类型与引用类型:复习
什么是值类型? 值类型: 就是非类类型,委托类型,接口类型,string类型的类型称为值类型. 引用类型类型:就是类类型,委托类型,接口类型,string类型称为引用类型. 值类型与引用类型的赋值问题 ...
- Net文件递归查找并保存
原理:遍历当前文件夹的子文件,保存遍历文件夹下的所有文件 主要方法(2个): //获取文件夹下的所有文件 并保存 string[] path = Directory.GetFiles(NeedFile ...