Skip to content

一款用于在网页中打印Office文件的软件,可以打印包括Word、PowerP oint、Excel、PDF、图片等文件。

License

Notifications You must be signed in to change notification settings

a6051529/office-print

Repository files navigation

office-print

build status code coverage code style styled with prettier made with lass license npm downloads

打印精灵,一款用于在网页中打印Office文件的软件,可以打印包括Word、PowerP oint、Excel、PDF、图片等文件。

Table of Contents

详细信息请访问https://www.innben.com/print了解

Install

npm:

npm install office-print --save

yarn:

yarn add office-print --save

Usage

一、打印网络excel、Word、PowerPoint、PDF

const OfficePrint = require('office-print');

let fileUrl = 'your network excel url';
fetch(fileUrl).then(response => response.arrayBuffer()).then(arrayBuffer => {
  	let file = new File([arrayBuffer], filename);
	  const officePrint = new OfficePrint();
		officePrint.print(file)
});
// script

二、打印本地电脑中的excel、Word、PowerPoint、PDF

<input type="file" id="input">
const OfficePrint = require('office-print');

const inputElement = document.getElementById("input");
inputElement.addEventListener("change", handleFiles, false);
function handleFiles() {
    const fileList = this.files; /* 现在你可以处理文件列表 */
  	fileList.forEach(file => {
			const officePrint = new OfficePrint();
			officePrint.print(file)    
    });
}
// script

三、已知本地文件路径,直接打印本地电脑中的excel、Word、PowerPoint、PDF

const OfficePrint = require('office-print');

let fileUrl = 'your local file system excel url';
const officePrint = new OfficePrint();
			officePrint.printFile(fileUrl)    

Contributors

License

About

一款用于在网页中打印Office文件的软件,可以打印包括Word、PowerP oint、Excel、PDF、图片等文件。

Resources

License

Stars

Watchers

Forks

Packages

No packages published