itext

SVG line not getting rendered properly in PDF

我的未来我决定 提交于 2020-01-02 11:02:14
问题 I am using iText and some SVG rendering library. I want to render a SVG image to PDF. I am using following code to do that. Now the problem is I am giving an area chart SVG to it, it is not rendering line properly. Attaching screenshots. Following classes has been used: import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.DocumentLoader; import org.apache.batik.bridge.GVTBuilder; import org.apache.batik.bridge.UserAgent; import org.apache.batik.bridge.UserAgentAdapter;

SVG line not getting rendered properly in PDF

a 夏天 提交于 2020-01-02 11:01:30
问题 I am using iText and some SVG rendering library. I want to render a SVG image to PDF. I am using following code to do that. Now the problem is I am giving an area chart SVG to it, it is not rendering line properly. Attaching screenshots. Following classes has been used: import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.DocumentLoader; import org.apache.batik.bridge.GVTBuilder; import org.apache.batik.bridge.UserAgent; import org.apache.batik.bridge.UserAgentAdapter;

Why the text extracted from PDF using PDF text extractors for java such as PDFBox , itext are scatted and unstructured?

♀尐吖头ヾ 提交于 2020-01-02 07:02:21
问题 I extracted text from a pdf using both Apache PDFbox and iText. But both the extracted text are completely unstructured and messy This is but the extracted text is :: 111111 1111111111111111111111111111111111111111111111111111111111111 US008631488B2 (12) United States Patent (10) Patent No.: US 8,631,488 B2 Oz et al. (45) Date of Patent: Jan. 14,2014 6,813,682 B2 1112004 Bress et al. (54) SYSTEMS AND METHODS FOR PROVIDING 7,065,644 B2 Daniell et al. 6/2006 SECURITY SERVICES DURING POWER Todd

JAVA使用ItextPDF

心不动则不痛 提交于 2020-01-01 22:38:06
1.背景 在某些业务场景中,需要提供相关的电子凭证,比如网银/支付宝中转账的电子回单,签约的电子合同等。方便用户查看,下载,打印。目前常用的解决方案是,把相关数据信息,生成对应的pdf文件返回给用户。 本文源码:http://git.oschina.net/lujianing/java_pdf_demo 2.iText iText是著名的开放源码的站点sourceforge一个项目,是用于生成PDF文档的一个java类库。通过iText不仅可以生成PDF或rtf的文档,而且可以将XML、Html文件转化为PDF文件。 iText 官网:http://itextpdf.com/ iText 开发文档: http://developers.itextpdf.com/developers-home iText目前有两套版本iText5和iText7。iText5应该是网上用的比较多的一个版本。iText5因为是很多开发者参与贡献代码,因此在一些规范和设计上存在不合理的地方。iText7是后来官方针对iText5的 重构 ,两个版本差别还是挺大的。不过在实际使用中,一般用到的都比较简单,所以不用特别拘泥于使用哪个版本。比如我们在http://mvnrepository.com/中搜索iText,出来的都是iText5的依赖。 来个最简单的例子: 添加依赖: 1 2 3 4 5 6 <!--

实战 iTextSharp

与世无争的帅哥 提交于 2020-01-01 22:35:25
iTextSharp 是用来生成 PDF 的一个组件,在 1998 年夏天的时候,Bruno Lowagie ,iText 的创作者,参与了学校的一个项目,当时使用 HTML 来生成报告,但是,使用 HTML 打印的效果很不理想。最后,他发现,使用 PDF 可以完美解决打印问题,为了能够在各个系统中使用,iText 组件库诞生了。 最初的 iText 主要是支持 Java 語言。之後針對Microsoft .NET C Sharp做了一個版本,也就是我們今天要介紹的 iTextSharp。 目前,iTextSharp 的版本是 5.1.2,下载地址: http://sourceforge.net/projects/itextsharp/files/ 其中主要包含了核心组件:itextsharp.dll 但是,直接使用它并不能处理中文,你还要下载两个组件。 在下载页面中,注意图中标注的 extras 文件夹。 点击之后,可以看到如下的下载: 注意把标注的两个压缩包下载下来,这是使用中文的关键。解开两个压缩之后可以看到下面的两个文件。 iTextAsianCmaps.dll iTextAsian.dll 在创建的项目中,将这三个程序集都添加到项目的引用中。 // 必须先加入资源 BaseFont.AddToResourceSearch("iTextAsian.dll");

itextpdf JAVA 输出PDF文档

你说的曾经没有我的故事 提交于 2020-01-01 22:31:07
使用JAVA生成PDF的时候,还是有些注意事项需要处理的。 第一、中文问题,默认的itext是不支持中文的,想要支持,需要做些处理。   1、直接引用操作系统的中文字体库支持,由于此方案限制性强,又绑定了操作系统,所以此处不做实现,有兴趣可在网上搜索看看。   2、引用itext-asian.jar包的字体支持,代码稍后上。     itext pdf引入中文常见异常:     com.itextpdf.text.DocumentException: Font 'STSongStd-Light' with 'UniGB-UCS2-H' is not recognized.     解决方案:a、引入操作系统字体;2、将字体维护进jar包中,如果没有,直接找到字体放入对应jar包中,如果是路径错误,则更改包路径;3、通过itext-asian.jar来加载中文包。 第二、表格中的设置,特别是上中下,左中右,不同的对象有不同的枚举实现,刚入手很容易混淆。其外是前景色,背景色,表格颜色等等。 第三、输出图片,很容易报错。     itext pdf常见输出图片异常:     An error exists on this page. Acrobat may not display the page correctly. Please contact the person who

java使用iText生成pdf表格

℡╲_俬逩灬. 提交于 2020-01-01 22:26:58
首先导入如下jar包:    package poi.zr.com.pojo; import java.awt.Color; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.lowagie.text.BadElementException; import com.lowagie.text.Cell; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Element; import com.lowagie.text.Font; import com.lowagie.text.PageSize; import com.lowagie.text.Paragraph; import com.lowagie.text.Phrase; import com.lowagie.text.Table; import com.lowagie.text.pdf.BaseFont;

【PDF】java使用Itext生成pdf文档--详解

我是研究僧i 提交于 2020-01-01 22:20:51
【 API接口 】 一、Itext简介 API地址:javadoc/index.html; 如 D:/MyJAR/原JAR包/PDF/itext-5.5.3/itextpdf-5.5.3-javadoc/index.html 功能:a Free Java-PDF; 中文支持:iTextAsian.jar,现在高版本Itext不支持语言包。 使用的版本:iTextpdf-5.0.0.jar, iTextAsian-2.0.jar,或者不用 iTextAsian-2.0.jar,直接使用ttf或ttc字体库 二、Itext API (一)PDF文档生成的5步 [java] view plain copy /** * 5步生成一个PDF */ public void createPdf() throws Exception { // 1-创建文本对象 Document Document document = new Document(PageSize.A4, 500 , 150 , 50 , 50 ); // 2-初始化 pdf输出对象 PdfWriter PdfWriter.getInstance(document, out); // 3-打开 Document document.open(); // 4-往 Document 添加内容 document.add( new

Itext change bookmarks zoom level to inherit zoom in existing pdf

这一生的挚爱 提交于 2020-01-01 19:19:08
问题 Using the iText5 PDF library, I am able to read bookmarks exist in PDF. Now I want to change the zoom level of bookmarks (Inherit zoom) in existing PDF using iText. Is it possible using the iText PDF library, and how? I have attached a screenshot. This is the code I am using to change the bookmark zoom level (as per @lowagie comment): public void changeList(List<HashMap<String, Object>> list) { for (HashMap<String, Object> entry : list) { for (String key : entry.keySet()) { System.out.println

Shrink PDF pages with rotation using Rectangle in existing PDF

▼魔方 西西 提交于 2020-01-01 17:10:51
问题 I am using following code to shrink every pages (Top and bottom) of existing pdf using iText library. Code working fine. But now if i process result pdf , i get 0 value for rotation of every page, while old pdf has other rotation too(i.e. 90deg). I want to keep rotation as it is but unable to do it. Code i am using As below to shrink pages public void shrinkPDFPages() throws Exception { PdfReader reader = new PdfReader("D:/testpdfs/test.pdf"); Document doc = new Document(); PdfWriter writer =