我正在生成一个文档,如下面的代码所示,除了表格的内容,这些内容各不相同.我需要做的是确保此表的大小不会超过一页,无论单元格中的内容量如何.有办法吗?
import com.itextpdf.text.Phrase; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.PageSize; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import java.awt.Desktop; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException;Run Code Online (Sandbox Code Playgroud)public void createTemplate() throws DocumentException, FileNotFoundException, IOException{ String TARGET = System.getProperty("user.home")+"\temp.pdf";
Document document = new Document(PageSize.A4); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(TARGET)); document.open();PdfPTable table = new PdfPTable(7); for (int i = 0; i < 105; i++) { Phrase p = new Phrase("some text"); PdfPCell cell = new PdfPCell(); cell.addElement(p); table.addCell(cell); } table.setTotalWidth(PageSize.A4.getWidth()-10); table.setLockedWidth(true); PdfContentByte canvas = …
这就是我所拥有的:
我正在运行的问题是,在某些情况下,发送到表单所需的数据大约是8000个字符,当IE仅在网址中允许2083个字符时.
根据客户端的要求,我们需要做客户端的一切,这意味着无法访问php,c#,java.我也在使用Acrobat Pro X来处理pdfs.
有没有办法提交帖子请求,在pdf中处理该请求,填写表格并将填好的表格返回给用户?还有另一种方法来绕过IE的2083字符限制吗?
实际上我想知道不同的PDF创建/生成技术之间的区别或比较.IText,Adobe LC,Jasper Reports等
我想知道使用它们的确切优点/缺点.
目前我正在使用Adobe LC ES2,并且想知道使用adobe优于其他技术的优势.
谢谢,AS
我正在使用itext库设计一个pdf报告.我已经在其中实现了一个段落.现在根据我的要求,我必须在背景颜色的矩形框内设置这个段落,但我无法做到.
这是我在java中的Itext代码...
Font f = new Font(FontFamily.TIMES_ROMAN, 25.0f, Font.BOLD, BaseColor.CYAN);
Paragraph p = new Paragraph("Total Cost:" + dbsumcallcost, f);
document.add(p);
Run Code Online (Sandbox Code Playgroud)
请大家帮帮我 提前致谢..
合并后打印pdf文件时出现以下问题,pdf文档被截断.有时会发生这种情况,因为文件不是8.5 x 11,它们可能像11 x 17.
我们可以让它检测页面大小,然后对这些文档使用相同的页面大小吗?或者,如果没有,它是否可以适合页面?
以下是代码:
package com.sumit.program;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.itextpdf.text.Document;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfImportedPage;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfWriter;
public class MergePdf {
public static void main(String[] args) {
try {
List<InputStream> pdfs = new ArrayList<InputStream>();
pdfs.add(new FileInputStream("C:\\Documents and Settings\\Sumit\\Desktop\\NewEcnProject\\Document1.pdf"));
pdfs.add(new FileInputStream("C:\\Documents and Settings\\Sumit\\Desktop\\NewEcnProject\\Landscape.pdf"));
OutputStream output = new FileOutputStream("C:\\Documents and Settings\\Sumit\\Desktop\\NewEcnProject\\merge1.pdf");
MergePdf.concatPDFs(pdfs, output, true);
} catch (Exception e) …
Run Code Online (Sandbox Code Playgroud) 我有一个带有示例的字符串 - 它的效果非常好,但是当我添加波兰字母时,它们就消失了.我试过这样的事情:
byte[] byteArray = str.getBytes(Charset.forName("UTF-8"));
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
worker.parseXHtml(pdfWriter, document, byteArrayInputStream, Charset.forName("UTF-8"));
Run Code Online (Sandbox Code Playgroud)
但它没有改变任何东西.如何添加波兰字母?
编辑:它仍然无法正常工作.
码:
document.open();
XMLWorkerHelper worker = XMLWorkerHelper.getInstance();
String str = "<html><head></head><body style=\"font-size:12.0pt; font-family:Times New Roman\">"+
"<a href='http://www.rgagnon.com/howto.html'><b>Real's HowTo</b></a>" +
"<h1>Show your support</h1>" +
"<p>It DOES cost a lot to produce this site - in ISP storage and transfer fees</p>" +
"<p>TEST POLSKICH ZNAKÓW: ???CÓó????????</p>" +
"<hr/>" +
"<p>the huge amounts of time it takes for one person to design and write the actual …
Run Code Online (Sandbox Code Playgroud) 我PdfWriter
用来创建PDF文档。我PdfPTable
要在PDF文档中添加一个。该表具有标题行,然后具有实际数据行。如果表很大,那么它的一部分将结转到新页面。我希望此页面也具有表标题行。但是,我只在表数据进入新页面时才需要此标题行。
我需要创建一个具有自定义彩色单元格和边框的表格。Color
类中定义了一些常量,但我需要自定义颜色。我需要#a6cb0b 作为带有颜色代码#cccccc 的标题和边框线的背景颜色。我如何设置它们?
Table table = new Table(new float[]{1,1,1});
Cell cell = new Cell();
cell.add(new Paragraph("TITLE"));
cell.setBackgroundColor(Color.???);
table.addCell(cell);
...
...
Run Code Online (Sandbox Code Playgroud) 我有 WPF 应用程序,我想在我的代码中实现 colspan 和 rowspan 。我使用 iText 版本 7 将数据导出为 PDF。但是我不知道如何定义Cell
对象的 colspan 或 rowspan 。有什么办法可以解决这个问题吗?
我的目标实际上是在表中创建主标题和子标题。
我的输出:
目标输出:
我的代码如下:
using iText.IO.Font.Constants;
using iText.Kernel.Font;
using iText.Kernel.Geom;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using Microsoft.Win32;
using System.Diagnostics;
using System.Windows;
namespace ITextPdf.UI
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Export_Btn(object sender, RoutedEventArgs e)
{
SaveFileDialog dlg = new SaveFileDialog
{
DefaultExt = ".pdf",
Filter = "Adobe PDF Files(*.pdf)|*.pdf",
FilterIndex = 1
}; …
Run Code Online (Sandbox Code Playgroud) 我刚刚使用 itext 签署了文件。我也有LTV。
我在 itext 文档中阅读-“DSS 包含对证书的引用,我们可以添加对 OCSP 响应和可用于重新验证证书的 CRL 的引用”
是的,我在 DSS 中找到了它们。
我还读到:“在 DSS 中,我们可以存储 VRI”
我不明白为什么要使用 VRI?因为在 DSS 中有相同的 OCSP 响应和证书。
还有 /61A2411B1..... 是什么意思?它是一些哈希还是随机数?