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

龙岗网站优化公司案例深圳市南山区网站建设

龙岗网站优化公司案例,深圳市南山区网站建设,域名解析错误是怎么回事,网站开发的接口文档​ 最近接到用户提过来的需求#xff0c;需要一个能够自动打印图纸的功能#xff0c;经过几天的研究整出来个初版了的#xff0c;分享出来给大家#xff0c;希望能有帮助。 需求描述: ​ 生产车间现场每天都有大量的图纸需要打印#xff0c;一个一个打印太慢了#xff0…​ 最近接到用户提过来的需求需要一个能够自动打印图纸的功能经过几天的研究整出来个初版了的分享出来给大家希望能有帮助。 需求描述: ​ 生产车间现场每天都有大量的图纸需要打印一个一个打印太慢了希望可以有个批量打印的功能。 分析 ​ 我们的图纸是存在服务器上都是pdf版本的所以批量打印程序可以通过文件名称然后程序自动将共享文件推送到打印机上打印这样就可以实现自动化了并且后续还可以根据情况进行扩展 代码 初版的程序比较简单使用的是springboot spring shell 来实现具体代码如下 !-- pom.xml 片段 -- !-- spring-boot-starter 版本是随意选的 -- parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.7.14/version /parent dependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-actuator/artifactId/dependency!-- spring-shell 版本需要与 spring-boot-starter 匹配 --dependencygroupIdorg.springframework.shell/groupIdartifactIdspring-shell-starter/artifactIdversion2.1.11/version/dependencydependencygroupIdorg.projectlombok/groupIdartifactIdlombok/artifactIdversion1.18.26/versionoptionaltrue/optionalscopecompile/scope/dependencydependencygroupIdorg.apache.pdfbox/groupIdartifactIdpdfbox/artifactIdversion2.0.26/version/dependencydependencygroupIdcn.hutool/groupIdartifactIdhutool-all/artifactIdversion5.8.22/version/dependency/dependenciesbuildfinalNameDrawPrinter/finalNamepluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactIdversion2.5.4/version !-- 使用适合你的Spring Boot版本 --executionsexecutiongoalsgoalrepackage/goal/goals/execution/executions/plugin/plugins/buildshell命令代码 package xxxx;import cn.hutool.core.util.StrUtil; import com.higer.ipd.tools.drawprinter.commons.PdfPrinter; import com.higer.ipd.tools.drawprinter.entity.DrawInfoEntity; import com.higer.ipd.tools.drawprinter.service.IDrawInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.shell.standard.ShellComponent; import org.springframework.shell.standard.ShellMethod;import java.io.File; import java.util.HashMap; import java.util.List;ShellComponent public class CommonCommand {Autowiredprivate IDrawInfoService drawInfoService;ShellMethod(value 打印消息,key000,group test)public void printMessage(String message) {System.out.println(message);}ShellMethod(value 查看本地打印机,key101,group print)public void showLocPrinter(){PdfPrinter.getLocalPrinter().keySet().forEach(System.out::println);}ShellMethod(value打印图纸,key103,group print)public void printPdf(String printerName,String fileName,String pageSize){try {String result PdfPrinter.print(new File(fileName), printerName, pageSize);if(StrUtil.isBlank(result)){System.out.println(打印成功);}else{System.out.println(result);}} catch (Exception e) {e.printStackTrace();System.out.println(打印出错!);}} }上面开发了两个shell命令:“查看本地打印机和打印图纸”. 打印图纸代码片段如下 public static String print(File file, String printerName,String pageSize) throws Exception {if(StrUtil.isBlank(printerName) || file null || !file.exists()){return 未指定打印机或待文件不存在请确认;}// 1.根据打印机名称找到对应的打印机服务MapString, PrintService printerMap getLocalPrinter();PrintService printService printerMap.get(printerName);if(printService null){return 没有找到指定的打印机;}// 2.加载pdf文件并设置打印配置打印try (PDDocument document PDDocument.load(file)){PrinterJob printJob PrinterJob.getPrinterJob();printJob.setJobName(file.getName());printJob.setPrintService(printService);PDFPrintable pdfPrintable new PDFPrintable(document, Scaling.SCALE_TO_FIT);Book book new Book();PageFormat pageFormat new PageFormat();pageFormat.setOrientation(PageFormat.PORTRAIT);//纵向pageFormat.setPaper(getPaper(pageSize));//设置纸张book.append(pdfPrintable, pageFormat, document.getNumberOfPages());printJob.setPageable(book);printJob.setCopies(1);//设置打印份数HashPrintRequestAttributeSet pars new HashPrintRequestAttributeSet();pars.add(Sides.ONE_SIDED); //设置单双页printJob.print(pars);}return ; }效果 启动后进入输入命令状态输入help可以看到帮助信息效果如下 输入 help 103 可以看到打印图纸的帮助信息命令格式为: 103 打印机名称 文件名称 页面大小A3/A4 源码下载
http://www.hkea.cn/news/14324808/

相关文章:

  • 杨浦手机网站建设wordpress 主教程从零始制作wordpress
  • 加强网站政务服务建设购物网站销售管理
  • 网页制作网站建设实战大全莱芜网吧恢复营业
  • wordpress网站更改主题信息咸阳鑫承网站建设
  • 宁波公司建网站哪家好网站条形码如何做
  • 便利的网站建设网站设计的硬件
  • 南宁企业网站排名优化网站后台传不了图片
  • 重庆开县网站建设公司嘉兴搜索引擎网站推广
  • 网站后台上图片后网页显示不正确怎么做网站教程html文本文档
  • 谷歌google官方网站响应式网站开发流程
  • 企业网站的域名是该企业的深圳网站建设公司信任湖南岚鸿信 赖
  • 山西做网站哪个好建立企业网站的技能
  • 外贸网站建站多少钱响应式企业网站案例
  • 莘县做网站推广深圳品牌床垫有哪些
  • 厦门市建设局综合业务平台网站织梦行业网站模板
  • 思乐网站建设网站正在建设中请稍后
  • 可以上传自己做的视频的网站吗做网站网页维护手机App开发
  • 自助建站seo网站开发时如何设计英文版本
  • 做淘宝网站模块化网页制作软件
  • 高端型网站建设Wordpress 视频界面
  • 基于vue.js旅游网站开发宜宾长宁网站建设
  • 上海哪个网站专门做宝宝宴的龙岩app设计
  • 网站推广渠道怎么做养车网站开发
  • 学院网站建设目的与意义网站设计效果专业乐云seo
  • 企业网站模板湖南岚鸿模板做网站造假
  • 广州企业建站公司易支付对接WordPress
  • wordpress导航网站模板被网络运营公司骗了去哪里投诉
  • 上海网站建设高端wordpress 快讯模板
  • 网站开发调试iis泰州seo网站推广
  • 佛山网站建设凤软创新的做pc端网站