小编Gal*_*ezu的帖子

如何在java中没有用户交互的情况下将pdf打印到特定的托盘

我正在尝试设置一个晚上运行的服务,将一堆发票和其他文件自动打印到一堆打印机上.截至目前,我可以打印好文件,但我需要能够指定一个托盘(一个带有我们公司的信头和一个带有白纸)我迄今为止所尝试的所有东西都没有用,我指定了PrintRequestAttribute集中的MediaTray属性,但似乎没有做任何事情.有人有这样的经历吗?

我用于测试的当前代码看起来像这样.

// Create a PDFFile from a File reference
File f = new File("C:\\File.pdf");
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
PDFFile pdfFile = new PDFFile(bb); // Create PDF Print Page
PDFPrintPage pages = new PDFPrintPage(pdfFile);

// Create Print Job
PrinterJob pjob = PrinterJob.getPrinterJob();
PageFormat pf = PrinterJob.getPrinterJob().defaultPage();
pjob.setJobName(f.getName());
Book book = new Book();
book.append(pages, pf, pdfFile.getNumPages());
pjob.setPageable(book);
// Send print job to default printer


PrintRequestAttributeSet aset=new HashPrintRequestAttributeSet();
aset.add(MediaTray.MIDDLE); //Used several …
Run Code Online (Sandbox Code Playgroud)

java printing pdf

7
推荐指数
1
解决办法
5309
查看次数

用Java自动处理电子邮件

刚收到老板要求我正在处理的申请.基本上我们正在为外部客户端设置电子邮件地址以提交excel文件.

我需要的是一种自动获取发送到该地址的任何电子邮件的方法,因此我可以获取附件,处理它并将其保存到文件夹中.

即使从哪里开始的任何信息都会有所帮助.

注意:我们使用Lotus Notes服务器来执行此操作,但通用方法会更有帮助(如果可能).

java email lotus-notes

4
推荐指数
1
解决办法
5833
查看次数

Apache POI中的负单元格值样式

使用Apache POI生成文档,我对单元格样式有一个小问题,currentlly我正在使用:

CellStyle currencyCellStyle=workbook.createCellStyle();
currencyCellStyle.setDataFormat(format.getFormat("$#,##0.00"));
Run Code Online (Sandbox Code Playgroud)

这对于正数而言完全正常,但是我想自动为负数单元分配不同的样式.

问题是有没有设置它而不必检查单个单元格值并为它们分配单独的样式?

或者有没有办法告诉Apache POI使用内置的Excel货币格式和其中一个否定选项?

java apache excel apache-poi

0
推荐指数
1
解决办法
3939
查看次数

标签 统计

java ×3

apache ×1

apache-poi ×1

email ×1

excel ×1

lotus-notes ×1

pdf ×1

printing ×1