首页 \ 问答 \ java 二维码

java 二维码

java 怎么生成二维码格式Data matrix图片?不是QRCODE的
更新时间:2023-09-07 15:09

最满意答案

要将页面报表导出到pdf中,但是报表中有checkbox复选框,需要要后台利用itext生成,生成复选框的方法如下: 
PdfContentByte cb = writer.getDirectContent();
cb.moveTo(0, 0);
PdfFormField field = PdfFormField.createCheckBox(writer);
PdfAppearance tpOff = cb.createAppearance(20, 20);
PdfAppearance tpOn = cb.createAppearance(20, 20);
tpOff.rectangle(1, 1, 18, 18);
tpOff.stroke(); 
//
tpOn.setRGBColorFill(255, 128, 128);
tpOn.rectangle(1, 1, 18, 18);
tpOn.fillStroke();
tpOn.moveTo(1, 1);
tpOn.lineTo(19, 19);
tpOn.moveTo(1, 19);
tpOn.lineTo(19, 1);
tpOn.stroke();

field.setWidget(new Rectangle(100, 700, 120, 720), PdfAnnotation.HIGHLIGHT_INVERT);
field.setFieldName("Urgent");
field.setValueAsName("On");
field.setAppearanceState("Off"); 
//            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff); 
//            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "On", tpOn);
writer.addAnnotation(field);

其他回答

搜一下:java itext pdf 怎样将复选框打上对号

相关问答

更多
  • 要将页面报表导出到pdf中,但是报表中有checkbox复选框,需要要后台利用itext生成,生成复选框的方法如下: PdfContentByte cb = writer.getDirectContent(); cb.moveTo(0, 0); PdfFormField field = PdfFormField.createCheckBox(writer); PdfAppearance tpOff = cb.createAppearance(20, 20); PdfAppearance tpOn = cb. ...
  • 正如我在这里看到的 ,您需要使用以下方法检查可用状态: String[] states = fields.getAppearanceStates("checkbox"); 然后根据此String[]的选项设置状态 As I saw here, you need to check the available states using: String[] states = fields.getAppearanceStates("checkbox"); And then set the state accor ...
  • 看起来你必须使用iTextSharp而不是iText7。 看看NuGet版本,看起来iTextSharp本质上就是iText5 .NET版本,就像上面评论中提到的Bruno一样,XFA的东西根本没有被移植到iText7 for .NET。 混淆源于在NuGet中同时具有iText7和iTextSharp版本,并且试用页面也没有说明XFA工作者不能用于.NET版本的iText7(但是?) 我做了以下工作来完成我至少需要试用的东西: 请在此处申请试用版: http : //demo.itextsupport.c ...
  • 如果您打算使用iText,最好使用iText7。 这是iText的最新版本,并且已经完成了大量的错误修正(特别是对于表格)。 有人说过,当我看一下这个例子时,似乎这个例子只是遍历所有单元格并将它们添加到iText Table对象中。 iText7完全可以做同样的事情。 您使用适当数量的列创建一个表,然后向其中添加单元格。 你的问题(据我所知)归结为“我如何设置iText表格单元格”。 这是一段只生成表格的示例代码。 我已经指出了你可以在哪里设置表格内容的样式。 public static void main ...
  • 查看iText in Action中的ListUsedFonts示例。 http://itextpdf.com/examples/iia.php?id=287 看起来这将打印出pdf中使用的字体以及它们是否嵌入。 /* * This class is part of the book "iText in Action - 2nd Edition" * written by Bruno Lowagie (ISBN: 9781935182610) * For more info, go to: http: ...
  • 我是否正确理解您要设置吸气状态? 外观状态对应于/ AS键,其值为/ Off或/ Yes。 您使用的值必须与您为自己定义的外观词典对应,而您可以省略/ Off外观。 / Off外观的名称已修复,但您可以(至少最多为PDF 1.7)定义您自己的/ On(或/ Yes)外观... 使用iText设置外观状态: Item item = acroFields.getFieldItem("checkbox"); PdfDictionary dict = item.getWidget(0); dict.put(PdfN ...
  • 我假设这是一个带有空参数列表的静态方法。 如果是这种情况,请更正您的代码。 你认为有一个空的挡块是明智的吗? 您的代码将吞下任何抛出的异常,您将不会更聪明。 打印堆栈跟踪。 I'll assume that this is a static method with an empty paramter list. If that's the case, please correct your code. Do you think it's wise to have an empty catch block? ...
  • 您必须使用包含这些字符的字体和编码。 您最好的选择是使用IDENTITY_H进行编码,因为这可以授予您访问给定字体中每个字符的权限: Font font = FontFactory.getFont(f.getName(),BaseFont.IDENTITY_H); 但你仍然需要使用正确的字体。 这个链接也可以证明对你有所帮助 编辑: 我也看到不同的Font使用不同的转换代码/序列: 使用不同字体的相应字符。 例如在Wingdings.ttf中,你有0x6F和0x70 You have to use a fo ...
  • 这是可能的,但需要一些努力。 你需要的是一个图像和一条路径。 路径应该是一个矩形,用于剪切图像(这样您只能看到要显示的精灵部分)。 以下是来自iText in Action的示例: part3.chapter10.ClippingPath It's possible but takes some effort. What you need is an image and a path. The path should be a rectangle and is used to clip the image ...
  • 这是解决方案: PdfFont normalFont = PdfFontFactory.createFont("C:\\Windows\\Fonts\\arial.ttf", "Identity-H", true); 您可以使用任何支持您的语言的字体。 Identity-H似乎也是PDF文件编码的重要组成部分。 This is the solution: PdfFont normalFont = PdfFontFactory.createFont("C:\\Windows\\Fonts\\arial.tt ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。