前言 我曾写过一篇文章,它主要介绍了如何通过物理打印机和虚拟打印机来打印Word文档.今天这篇教程将介绍一种新的方法来实现对Word文档的打印. 此次使用到的类库仍然是Spire.Doc for Java.它提供的PrinterJob类支持设置打印纸张大小.打印份数.是否弹出打印对话框等,且使用该方法打印出来的文档清晰度更高.类库可通过官网下载,解压后将lib文件夹下的Spire.Doc.jar手动导入IDEA中,或者也可通过Maven仓库安装导入产品及相关依赖. 代码演示 1 import c
通常web技术无法设置本地计算机的默认打印机,包括用代码设置纸张大小,如果业务系统中真遇到这种需求,只能通过其它辅助手段(比如ActiveX)实现.下面这段代码,出自网上被广泛使用的"泥人张打印API"(抱歉未找到原始出处),已经用C#封装了很多关于底层打印的API方法 using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; usin
实现如下效果: 实现方式如下: using System;using System.Drawing.Printing;using System.Runtime.InteropServices;using System.Windows.Forms; namespace PISS.View.CustomControl{ public partial class PrinterConfigMessBox : Form { #region 定义.构造.初始化 [DllImport("winspool.d
public class OpenExe extends HttpServlet { //打开本地播放器并播放视频 public static void openExe(String file) { Runtime rn = Runtime.getRuntime(); Process p = null; try { p = rn.exec("D:/The entertainment software/QvodPlayer/QvodPlayer.exe "+file); } catch