itextsharp

How to search for Particular Line Contents in PDF and Make that Line Marked In Color using Itext in c#

☆樱花仙子☆ 提交于 2019-12-13 09:20:53
问题 I have a pdf file which i need to read and validate for its Correctness and if any wrong data Comes it should mark that Line with Red Color.Till Now i am able to read and Validate the Contents of the Pdf file by taking that into string but i am not getting how to make that line Colored,suppose Mark Red color in case any wrong data line comes.So my question is this that "How to search for Particular Line Contents in PDF and Make that Line Marked In Color". Here is my code in c#..

Itextsharp can't extract pdf unicode content in c#

☆樱花仙子☆ 提交于 2019-12-13 08:34:01
问题 I am trying to get the content of pdf file using itextsharp as you can see : static void Main(string[] args) { StringBuilder text = new StringBuilder(); using (PdfReader reader = new PdfReader(@"D:\a.pdf")) { for (int i = 1; i <= reader.NumberOfPages; i++) { text.Append(PdfTextExtractor.GetTextFromPage(reader, i)); } } System.IO.File.WriteAllText(@"c:/a.txt",text.ToString()); Console.ReadLine(); } My pdf content is written in Persian ,and after running the above code to result is like this :

iTextSharp Display only certain DataGridView columns

老子叫甜甜 提交于 2019-12-13 08:29:40
问题 I want to display only certain DataGridView columns in a PDF file using iTextSharp. I know you can insert the whole GridView into the PDF document. But is it possible to only show certain columns of the DataGridView? This is my code so far : iTextSharp.text.Font fontTable = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK); PdfPTable table = new PdfPTable(dataGridView1.Columns.Count); table.SpacingBefore = 45f; table.TotalWidth = 300; table.DefaultCell.Phrase = new

WriteSelectedRows doesnt show a table on PDF

£可爱£侵袭症+ 提交于 2019-12-13 08:02:01
问题 I need to split a big pdfptable with many colums, i use WriteSelectedRows, but there is no table showing up on my pdf. When i delete the WriteSelectedRows methode, and print the full table on the pdf its all working fine. Do i miss something? string imageFilePath = Server.MapPath(".") + "/images/test.jpg"; iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath); Document pdfDucment = new Document(new Rectangle(288f, 144f), 10, 10, 10, 10); pdfDucment.SetPageSize

How to introduce multiple PdfPageEventHelper instances?

蓝咒 提交于 2019-12-13 07:22:06
问题 I have to generate a large amount of different types of documents using the itextsharp library, all have things in common, some have common headers, page counts, watermarks my initial tought was to have different PdfPageEventHelper subclasses for example WatermarkPdfPageEventHelper , OrderHeaderPdfPageEventHelper , PageNumberPdfPageEventHelper etc and apply them when necessary to compose the documents but PageEvent is not really an event but an instance of only one IPdfEvent , what is the

Return true when chunk is used iTextSharp

我与影子孤独终老i 提交于 2019-12-13 06:14:36
问题 I'm trying to bold my font by using chunk. But the special thing is that my label is written under the addcell within a datareader. This is how i attempt to format my label within my datareader table.AddCell(phrase.Add(new Chunk("test:", normalFont)) + dr[0].ToString()); This is the declaration to phrase and font type: var normalFont = FontFactory.GetFont(FontFactory.HELVETICA, 12); var phrase = new Phrase(); And this is what is being displayed: However before i attempt to format my label

iTextSharp line separator disappears with PdfPageEventHelper

Deadly 提交于 2019-12-13 06:12:13
问题 I'm producing PDF reports using the iTextSharp library. I have a paragraph as title with a line underneath. When I add an PdfPageEventHelper class as PageEventListener to my writer which handles the background and page numbering on each page, the line disappears. I think it's about the alignment of the background and the line so the line is behind the background but I can't seem to arrange it in front. Document code: using (Document doc = new Document()) { Response.ContentType = "application

website using iTextSharp needs to save PDF on local machine C drive

冷暖自知 提交于 2019-12-13 06:01:40
问题 I'm trying to have iTextSharp create a PDF file of the web page and save it to the users computer C drive. This works in debug but when I publish it to the server files never get saved on the computer but the application is saying that it did save it. I think I need to set my path differently. This is in MVC4 C#. var pdfDoc = new Document(); const string folderPath = "C:\\SG-ListingPDFs\\"; bool isExists = Directory.Exists(folderPath); if (!isExists) Directory.CreateDirectory(folderPath); var

How to know if text exceeds the fill box in itextSharp

折月煮酒 提交于 2019-12-13 05:46:20
问题 I am using the following code: PdfReader PDFReader = new PdfReader("c:\\file.pdf"); FileStream Stream = new FileStream("c:\\new.pdf", FileMode.Create, FileAccess.Write); PdfStamper PDFStamper = new PdfStamper(PDFReader, Stream); for (int iCount = 0; iCount < PDFStamper.Reader.NumberOfPages; iCount++) { iTextSharp.text.Rectangle PageSize = PDFReader.GetCropBox(iCount + 1); PdfContentByte PDFData = PDFStamper.GetOverContent(iCount + 1); BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA

iTextSharp EXCEL output

一世执手 提交于 2019-12-13 05:45:23
问题 I am using the following code to output data from a number of tables in my database to an excel document. Protected void btnExcelExport_Click(object sender, EventArgs e) { string strQuery = "SELECT s.Story, s.StoryCategoryID, CONVERT(VARCHAR(10), s.CreationDate, 103) AS CreationDate, m.CompanyRole, af.Name FROM Story s INNER JOIN ProjectIterationMember pm ON pm.ProjectIterationMemberID = s.ProjectIterationMemberID INNER JOIN Iterations i ON i.ProjectIterationID = pm.ProjectIterationID INNER