itext

iTextSharp - Creating header/margins results in inconsistent page coordinates

百般思念 提交于 2020-01-06 17:58:02
问题 Why does the following code affect a page's ability to find its top, bottom, right and left? Before applying it, reader.GetCropBox(i).GetLeft(0) and reader.GetPageSize(i).GetLeft(0) return the far left point of every page in an assorted set. After applying it, GetLeft(0) is the far left on some pages and on others the left most point AFTER the margin ends. I'm trying to create a header on any given set of preexisting pages (ie, create white space and then put text in it) using (Stream stream

Converting complicated excel which containing images,drawings into pdf using java

瘦欲@ 提交于 2020-01-06 14:01:17
问题 can anyone please tell me whether it is possible to convert excel which containing images, drawings into pdf using poi and itext open source apis (openoffice not needed). My code is as given below, the code works fine...but comes to complicated excel i'm not getting the exact pdf import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Date; import java

Stuck on creating pdf file with iText

佐手、 提交于 2020-01-06 13:55:19
问题 I am trying to create pdf files using iText. I included itextpdf-5.5.3.jar into my project and following steps in this tutorial: http://blog.mettletech.co/wp/blog/generate-pdf-file-in-android/ But when this code i getting following errors: 10-30 16:52:57.163: E/dalvikvm(28969): Could not find class 'com.itextpdf.awt.PdfPrinterGraphics2D', referenced from method com.itextpdf.text.pdf.PdfContentByte.createPrinterGraphicsShapes 10-30 16:52:57.213: E/dalvikvm(28969): Could not find class 'java

iTextSharp problem concatenating PDF documents

女生的网名这么多〃 提交于 2020-01-06 13:52:43
问题 I am trying to build up a single PDF from a bunch of other PDFs that I am filling out some form values in. Essentially I am doing a PDF mail merge. My code is below: byte[] completedDocument = null; using (MemoryStream streamCompleted = new MemoryStream()) { using (Document document = new Document()) { document.Open(); PdfCopy copy = new PdfCopy(document, streamCompleted); copy.Open(); foreach (var item in eventItems) { byte[] mergedDocument = null; PdfReader reader = new PdfReader

Set encryption password for pdf in xdocreport

寵の児 提交于 2020-01-06 13:30:27
问题 How to set encryption password while converting odt file to pdf in xdocreport? I am referring to PDFWriter.setEncryption method in iText here. 回答1: XDocReport 1.0.4 (which will soon released) provides fr.opensagres.xdocreport.itext.extension. IPdfWriterConfiguration which gives you the capability to customize the iText PDFWriter. Here a sample which set encryption : org.odftoolkit.odfdom.converter.pdf.PdfOptions options = new PdfOptions(); options.setConfiguration( new IPdfWriterConfiguration

Set encryption password for pdf in xdocreport

孤人 提交于 2020-01-06 13:30:02
问题 How to set encryption password while converting odt file to pdf in xdocreport? I am referring to PDFWriter.setEncryption method in iText here. 回答1: XDocReport 1.0.4 (which will soon released) provides fr.opensagres.xdocreport.itext.extension. IPdfWriterConfiguration which gives you the capability to customize the iText PDFWriter. Here a sample which set encryption : org.odftoolkit.odfdom.converter.pdf.PdfOptions options = new PdfOptions(); options.setConfiguration( new IPdfWriterConfiguration

iText “Coordinate outside allowed range” exception using LocationTextLocationStrategy

风格不统一 提交于 2020-01-06 08:45:06
问题 An exception "Coordinate outside allowed range" is thrown when I try to use LocationTextExtractionStrategy . for (int pageNum = 1; pageNum <= document.getNumberOfPages(); pageNum++) { PdfPage page = document.getPage(pageNum); sb.append(PdfTextExtractor.getTextFromPage(page, new LocationTextExtractionStrategy())); } More information about the exception: java.lang.IllegalStateException: Coordinate outside allowed range at com.itextpdf.kernel.pdf.canvas.parser.clipper.ClipperBase.rangeTest

Add pdf and tiff to the same pdf document and display it in the browser

感情迁移 提交于 2020-01-06 07:54:29
问题 I am using the below code to retrieve a file from an ftp server and display it in the browser. boolean fileFormatType = fileName.endsWith(".PDF"); if (fileFormatType) { if (FilePdf != null && FilePdf.length() > 0) { is = ftp.retrieveFileStream(strFile); bis = new BufferedInputStream(is); response.reset(); response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "inline;filename=example.pdf"); ServletOutputStream outputStream = response .getOutputStream(); System

Specify which columns to export to pdf from GridView using iTextSharp

戏子无情 提交于 2020-01-06 07:09:12
问题 I started using iTextSharp to export my data from my grid to a PDF document. As part of my grid I have columns which are not visible, however iTextSharp still export those columns which are invisible in the gridview to the PDF document. How can I specify which columns on my GridView to export to the PDF document so that the columns which are "visible=false" do not get displayed?? This is what I have so far: protected void btnExport_Click(object sender, EventArgs e) { PdfPTable pdfTable = new

iText Document : Rotate the page

柔情痞子 提交于 2020-01-06 06:58:20
问题 After the rotation of the document I lose the order of my data in the page : package com.mkyong.common.view; import java.io.File; import java.io.IOException; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.view.document.AbstractPdfView; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.PageSize; import com.lowagie.text.Table; import com