itextpdf | itextpdf freemarker 实现pdf的导出, 支持中文、图片以及外部样式 | Document Editor library
kandi X-RAY | itextpdf Summary
kandi X-RAY | itextpdf Summary
模板文件只是用于生成pdf, 所以双击打开的话, 图片和外部css是找不到的; 如果既想满足双击打开可以找到css和图片,又能通本工程中的示例, 那么需要另外处理了;至少本工程是没有兼容两者的. 1、目前只实现pdf文件的生成,与web项目pdf的导出还有些许不同, 但是已经支持中文、外部css、图片 可直接运行com.yzb.lee.test.Test.java的main方法来测试效果 文件路径:pdf.css在resources/css/目录下,aloner.jpg在resources/images/目录下, 模板文件是resources/template/template.html 获取java项目路径:2、servlet实现pdf的导出 工程部署后,请求地址:文件路径:pdf.css在webapp/css/目录下,aloner.jpg在webapp/images/目录下, 模板文件是resources/template/webTemplate.html 此时css文件、image文件与工程部署在同一个web容器中, 文件路径的获取与之前有所不同. 3、css、image等文件放到单独的文件服务器上 出于简单的演示效果,文件服务器与工程服务器还是同一个, css与image的链接方式与之前有所不同,可以看成是两个服务器 工程部署后,请求地址:文件路径:pdf.css、aloner.jpg在文件服务器上,写文件服务器的访问路径, 模板文件是resources/template/fileTemplate.html. 4、将字体-宋体 放到工程中, 以便适应不同操作系统的中文显示问题 工程部署后,请求地址:文件路径:pdf.css、aloner.jpg在文件服务器上,写文件服务器的访问路径, 模板文件是resources/template/fileTemplate.html 字体文件路径:resources/font/目录下. 5、阿里巴巴code review 阿里巴巴代码检视后,代码优化; 个人认为有可取的,但不是全部都可取 eclipse插件地址:
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of itextpdf
itextpdf Key Features
itextpdf Examples and Code Snippets
Community Discussions
Trending Discussions on itextpdf
QUESTION
Good day, dear colleagues.
Could you please help me to understand why is this error appears when the spring boot app is packed into the jar and no cause when app is being debugged from IDE?
...ANSWER
Answered 2021-Jun-08 at 11:41Don't use is.available()
to determine the length of the resource because in general that's not what this method returns (see many other questions, e.g.
this one).
Instead copy the whole stream via a buffer or use a utility method.
As you use iText 7, you can use its com.itextpdf.io.util.StreamUtil
utility
QUESTION
I need to remove Leading property in first Paragrapg on every page(FixedLeading)?
...ANSWER
Answered 2021-Jun-01 at 17:09Your approach seems plausible: I imagine it could be improved by looping through all the overflow renderers (perhaphs, I will try it out and update the answer someday).
However, there is quite a different approach, which for me seems to be more convenient and accurate: why not to override ParagraphRenderer
, so that leading is reset each time the corresponding Paragraph
can not fit a page (and hence will be moved to the next page).
This is how such an extension class may look:
QUESTION
I'm trying to do a date range based filter to export a report into a PDF; however, when I click to export the PDF, I get the following message: ExceptionConverter: java.io.IOException: The document has no pages. Here's my PDF class' code:
...ANSWER
Answered 2021-May-29 at 17:55It seems that your SQL request doesn't return any row,
Put your PdfTable(3) out of your while();
QUESTION
I have imported an existing maven project into eclipse. When I try to build the maven project I get error 'clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on JDK 9+' message. I have JDK 8 and Maven version 'Apache Maven 3.0.5' installed. Eclipse Version is Photon Milestone 3 (4.8.0M3). My POM file looks like below.
Can someone please help me resolve this?
...ANSWER
Answered 2021-May-20 at 07:36This issue was resolved after I installed Eclipse Oxygen. Turns out it was plugin issue in the eclipse build that I had.
QUESTION
I am using iText 5 Java for external signing. First I create signature appearance, calculate the hash for signed attributes and leave empty place for the signature. Later when I get the signed hash from client, I insert it the PDF via MakeSignature.signDeferred
.
But PDF reader is showing the signature as invalid. Complaining the PDF has been modified.
Here is the code used for signing. I have removed a lot of functioning code to keep the code at bare essentials.
...ANSWER
Answered 2021-May-15 at 15:52The problem was that EmptyContainer.sign
method just gives out PDF bytes and not the authenticated attributes. The authenticated attributes are actually which needs to be signed. Thanks mkl for pointing in the right direction.
I modified EmptyContainer.sign
method to create a PdfPKCS7
object and call PdfPKCS7.getAuthenticatedAttributeBytes
with PDF hash as one of the arguments.
After signing the bytes returned by getAuthenticatedAttributeBytes()
method and creating CMS container of the signed bytes and the original hash, I was able to successfully sign the PDF.
Here is the code if someone needs it. It is cluttered all over but you will get the essence.
QUESTION
Hi guys I am an absolute beginner so go easy on me, why is this not working for me, I really do not understand why this is not working, but I am a beginner so if someone could correct this for me, I would really appreciate it. I am surprised that it does not work
...ANSWER
Answered 2021-May-08 at 18:48iText 7.0 had a method add(String)
for Cell
.
For iText 7.1, as documented in the API, a Cell
takes only a block element or an image for its add()
method. Block elements in iText are things like paragraphs, lists and divs.
You can wrap your String
in a Paragraph
:
QUESTION
I'm trying to use itextpdf5 but IntelliJ doesn't seem to find the package. I'm using Maven to manage the dependencies and this is what I added to my pom.xml
...ANSWER
Answered 2021-May-08 at 16:44You cannot import a package like that in Java.
Import a specific class:
import com.itextpdf.text.pdf.PdfReader;
Or import a full package:
import com.itextpdf.text.pdf.*;
QUESTION
I found this source code here. My question is how to rename the label by custom name without number. I think this code's row is similar, but without number is my purpose:
...ANSWER
Answered 2021-May-02 at 09:05For the SetPageLabel
method, both the first argument (numbering style) and the second (page label prefix) may be null, in order to omit them from the page labeling style.
To set a page label without numbering for page 4:
QUESTION
I am trying to get all the XMP metadata stream of a PDF file using the Java library to manipulate PDF files iText. The code I have written is:
...ANSWER
Answered 2021-Apr-30 at 19:48Unrelated to the issue of getting null, but doc.getXmpMetadata()
returns a byte array. So you will not be able to print its content with
QUESTION
I have been using iText (on .Net) for some time but have only recently started using htmlpdf instead of building the document manually.
In previous projects I used the following code to set the document metadata:
...ANSWER
Answered 2021-Apr-22 at 16:02application-name
is what you're looking for.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install itextpdf
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page