itext

Find a string and location in PDF file using iTextSharp using ASP.Net C#

孤街浪徒 提交于 2019-12-23 22:27:45
问题 I am trying to find a string and it's location in a PDF using iTextSharp in Asp.net C# for editing. But so far with the help available on Google I am unable to do it. This is the current code but it does read text chunk by chunk but couldn't find the required text. Need help Thanks public class RectAndText { public iTextSharp.text.Rectangle Rect; public String Text; public RectAndText(iTextSharp.text.Rectangle rect, String text) { this.Rect = rect; this.Text = text; } } public class

How to read a pdf using itext library in android

我与影子孤独终老i 提交于 2019-12-23 19:22:24
问题 I am a newbie in android world. I tired to create a android project using eclipse IDE, in which i tried reading a pdf file with the help of itext library. This pgm is not showing any output.Please tell me how to correct the code,so that i can extract the text from pdf file stored in Assets folder in the project. The program code is given as : public class hello extends Activity { /** Called when the activity is first created. */ public static final String LOG_TAG="Fifth"; @Override public

iText Maximum Font Size

▼魔方 西西 提交于 2019-12-23 19:01:36
问题 I'm using a fixed cell height to create a table. If the font size is too large, the text is not visible in the table. Is there a built-in function in iText that automatically reduces the font size to the maximum possible size, or do I have to implement this by myself? 回答1: Automatic font size is only possible in the context of AcroForm text fields. When you define the font size of a text field as 0, then a font size is chosen that fits the rectangle. In the case of a fixed cell height in a

Add an image to iText pdf in Android

爱⌒轻易说出口 提交于 2019-12-23 18:28:01
问题 I have an String containing images like "My string [img src=image_from_drawable/] blablabla". I'm able to parse this string as Spannable to show that drawable on my TextView, with the following code: static public Spannable formatAbility(String _ability) { Spannable spannable = spannableFactory.newSpannable(_ability); addImages(mContext, spannable); return spannable; } private static boolean addImages(Context context, Spannable spannable) { Pattern refImg = Pattern .compile("\\Q[img src=\\E(

iTextSharp: How to find the first and second row height in a table?

拜拜、爱过 提交于 2019-12-23 17:24:57
问题 I want to get the first and second column height to know if I need to call document.NewPage() or not. But, I can't find a way to do this without adding the table to the document. Example: PdfPRow firstRow = new PdfPRow(cells1.ToArray()); table.Rows.Add(firstRow); PdfPRow secondRow = new PdfPRow(cells2.ToArray()); table.Rows.Add(secondRow); float h1 = table.GetRowHeight(0), h2 = table.GetRowHeight(1); if (currentY - h1 - h2 < 30) document.NewPage(); document.Add(table); 回答1: See my answer here

p:dataExporter throws java.lang.NoClassDefFoundError: com/lowagie/text/phrase

强颜欢笑 提交于 2019-12-23 16:48:20
问题 I tried to use the data exporter control of primefaces 3.2. Following is the code: <p:commandLink value="export" ajax="false"> <p:dataExporter type="xls" target="dtable" fileName="myfile" /> </p:commandLink> <p:datatable id="dtable" ........../> When I click on export link, I get the following error: java.lang.NoClassDefFoundError: com/lowagie/text/phrase I downloaded itext jar 5.2.1 and included it in my application, still I get the same error. How do I solve it? 回答1: Try iText 2.1.7 not 5.2

iText: setting PDF view defaults

泪湿孤枕 提交于 2019-12-23 16:17:55
问题 I'm using iText for a bit of manipulating my PDFs through Java, and I'd like to make it so that a PDF default opens so that a single page fits in the window it opens, that this window is preferrably full screen, and that it has a thumbnail view on the lefthand side. I know other programs can set these view preferences, so I assume iText can, but I haven't figured out how or what part of the API I should be looking at. Do you have any suggestions? Cheers Nik 回答1: You have to use the

Creating PDF/A-3: Embedded file shall contain valid Params key

半世苍凉 提交于 2019-12-23 15:37:43
问题 im trying to create a PDF/A-3 with itextpdf-5.4.5 and itext-pdfa-5.4.5. When i set the PdfFileSpecification, i get the following Exception: com.itextpdf.text.pdf.PdfAConformanceException: Embedded file shall contain valid Params key. This is the part where i create the PdfDictionary: PdfDictionary params = new PdfDictionary(); params.put(PdfName.MODDATE, new PdfDate()); PdfFileSpecification fileSpec = PdfFileSpecification.fileEmbedded( writer, "./src/main/resources/com/itextpdf/invoice.xml",

Read specific value based on label name from PDF in C#

淺唱寂寞╮ 提交于 2019-12-23 15:29:20
问题 I have an asp.net Core 2.0 C# application which read/parse the PDF file and get the text. In this I want to read specific value which have specific label name. You can see the below image I want to get the value 171857 which is Invoice number and store it in database. I have tried below code to read the pdf using iTextSharp . using (PdfReader reader = new PdfReader(fileName)) { StringBuilder sb = new StringBuilder(); ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy(); for

Flying Saucer in Lotus Notes

无人久伴 提交于 2019-12-23 12:54:38
问题 I was trying to convert simple XHTML-files to PDF, and used Flying Saucer and iText to do so. It worked without problems in Java, however, when I tried to make a Lotus Notes agent with the same code, I got an exception I am unsure how to deal with. The code: import lotus.domino.*; import java.io.*; import com.lowagie.text.DocumentException; import org.xhtmlrenderer.pdf.ITextRenderer; import org.xhtmlrenderer.util.XRLog; import java.util.*; public class JavaAgent extends AgentBase { public