itext

How to associate search catalog file (.pdx) with PDF document

半腔热情 提交于 2019-12-25 03:22:55
问题 Using a .NET application, I am trying to create a PDF "table of contents" that references other files, like one would distribute on a DVD etc. For this purpose, I need a search index and catalog, so full-text search will work across documents. I have been able to automate the construction of the index by copying an "old" .pdx file (the directory structure is always the same) and then calling JavaScript from C#: var js = $@"catalog.getIndex(""{pdxFilePath}"").build('alert(""Hello"")', true)";

iText: PdfContentByte.rectangle(Rectangle) does not behave as expected

自作多情 提交于 2019-12-25 02:11:44
问题 I am using iText 2.1.7 and I am trying to draw a simple rectangle to my document. The below block of code works as expected and draws a rectangle that covers the entire page not including the page margins. Document document = new Document(PageSize.A4.rotate()); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); PdfContentByte canvas = writer.getDirectContent(); Rectangle pageDimensions = writer.getPageSize(); canvas.saveState(); canvas.rectangle( pageDimensions

Get the URL of current XHTML page which has user data filled in the form into the JSF Managed bean

倖福魔咒の 提交于 2019-12-25 02:09:01
问题 I am working with creating PDF from XHTML with JSF 2.0 and iText. The page is simple registration form. When User enters all the data in the page and click on submit I have to get the whole HTML page source with user entered values into the bean. I used Jsoup to get the HTML but I got only HTML source not the values entered by the user.How can I do this? My current code is FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext

Reduce PDF file size in itext (java)

痞子三分冷 提交于 2019-12-25 01:58:00
问题 I'm creating a Web-based label printing system. For every label, there should be a unique s/n. So when a user decided to create 1000 labels (with the same data), all of it should have unique s/n, therefore the pdf will have 1000 pages, which increases the file size. My problem is when the user decided to create more copies, the file size will get bigger. Is there any way that I can reduce the file size of the pdf using Itext? Or is there any way that I can generated the pdf and output it in

Java: Reading PDF bookmark names with itext

回眸只為那壹抹淺笑 提交于 2019-12-25 01:55:48
问题 I am working with a single PDF containing multiple documents. Each document has a bookmark. I need to read the bookmark names for a reconciliation application that I am building. The code below is not working for me. I am trying to place the bookmark name in the title string. Can anyone provide any guidance? Thank you very much. PdfReader reader = new PdfReader("C:\\Work\\Input.pdf"); List<HashMap<String,Object>> bookmarks = SimpleBookmark.getBookmark(reader); for(int i = 0; i < bookmarks

Get co-ordinates of image in pdf

百般思念 提交于 2019-12-25 01:48:40
问题 In my project, I want to find co-ordinates of image in pdf. I tried searching itext and pdfbox, but I was not succesful. Using these co-ordinates and extracted image, I want to verify whether the extracted image is same as image present in database, and co-ordinates of image are same as present in database. 回答1: When you say that you've tried with iText, I assume that you've used the ExtractImages example as the starting point for your code. This example uses the helper class

Rowspan or nested? Create a table itextsharp

ε祈祈猫儿з 提交于 2019-12-25 01:43:40
问题 I've been searching about how to merge two cells and I've found two answers Rowspan and Nested. I can't make my table with those two functions because I don't know how to merge cells at the begining and at the end. I've been trying many ways but this is driving me crazy. The table I want to make has 9 columns and 3 rows. So, I want the table looks like: | Header 1 | Header 2 | Header 3 | Header 4 | Header 5 | | | | H1 | H2 | H3 | H4 | H5 | | | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 |

How to retrieve the PdfStampAnnotation rotation

落花浮王杯 提交于 2019-12-25 01:33:07
问题 Referring to How to retrieve the image of a PdfStampAnnotation, how to retrieve the rotation of an stamp annotation ? I create a document, put a stamp1, turn the page and add another stamp2. The document is ok (stamp1 image is rotated and stamp2 is not) but the extracted the images are exactly the same (same orientation). I can get the page rotation with page.getRotation() // 90 And if I'm trying to get stamps (images) orientation // I expect to get 0 but get 90 stamp1.getPdfObject()

Arabic characters from html content to pdf using iText

為{幸葍}努か 提交于 2019-12-25 01:28:40
问题 I am having trouble to display the Arabic Characters from HTML Content in PDF Generation as " ? " I am able to display the Arabic text from String variable. At the same time I am not able to generate the Arabic Text from the HTML String. I want to display the PDF with two column, left side English and the right side Arabic Text. when I use the following program to convert into pdf. Please help me in this regard. try { Document document = new Document(PageSize.A4, 50, 50, 50, 50);

iTextSharp How include GenericTag using XML Parsing

☆樱花仙子☆ 提交于 2019-12-25 01:27:34
问题 I'm using iTextSharp library, specifically to view .xml documents and transform them into .pdf files as follows: var docWriter = PdfWriter.GetInstance(document, new FileStream("DOC.pdf", FileMode.Create)); ITextHandler xmlHandler = new ITextHandler(document); xmlHandler.Parse("MLDOC.xml"); I need to know if there is any way to include any attribute within the tags in my .xml file to indicate that they are GenericTag, or otherwise how I can identify a paragraph which I include a PdfAnnotation