itextsharp

which Class or namespace must add for use Class StyleAttrCSSResolver in itextSharp?

ぐ巨炮叔叔 提交于 2019-12-11 02:33:29
问题 I want that use itextSharp for convert html to pdf. and I want have a specific style in my pdf. I want that all pdf files follow a specific CSS class. but I don't know which namespace I must add that complier khnow StyleAttrCSSResolver class? please guide me! 回答1: That class is located here. Also you need to add a reference to the xmlworker assembly: PM> Install-Package itextsharp.xmlworker 回答2: Also available in "Friendly Nuget Packages" now http://www.nuget.org/packages/itextsharp.xmlworker

iTextSharp - Copying elements from one PDF to another

霸气de小男生 提交于 2019-12-11 02:21:52
问题 I want to copy certain elements from one PDF to another using iTextSharp. I want to read one PDF, read text elements from that and correct them and create a new PDF using the updated text elements and all the images etc. from the first PDF. Please help me how this can be achieved. 回答1: This task is very complex. I wrote a program to do this for a large greeting card maker. First you have to locate the text and calculate the glyph bounding boxes. Next you have to modify the contents stream to

how to save Extjs4 chart image to print in a pdf report?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 02:18:09
问题 i have several charts in my extjs4application dashboard.. i want to generate a pdf report using the images of those charts for that i use iTextSharp is there a way to get the images from the charts in order to include them in my report? the ideal for me is to use it like this with itextsharp MyImageStream = new MemoryStream(); myChart.SaveImage(MyImageStream); my chart would be the chart object i asked around in the forums they told me i would generate and render my chart at client (already

Read XMP from existing PDF with iTextSharp

筅森魡賤 提交于 2019-12-11 02:16:09
问题 How can I read XMP from an existing PDF file using iTextSharp? 回答1: I'm dangerously ignorant of itextSharp but this did the job for me: PdfReader pdf = new PdfReader(fileName); string metadataXml = System.Text.Encoding.Default.GetString(pdf.Metadata); 回答2: I'd encourage you to check out the iTextSharp.text.xml.xmp namespace. I've never done what you're trying to do but the XmpReader class looks promising. 来源: https://stackoverflow.com/questions/1522101/read-xmp-from-existing-pdf-with

How to programmaticaly construct PDFs with PDF/A format

谁说我不能喝 提交于 2019-12-11 01:48:24
问题 I need to write a NET application that will take various data from databases and construct a PDF which must be in PDF/A format because of the companies standards. So far I have looked at PDFSharp and iTextSharp I see a topic in PDFSharp forums http://forum.pdfsharp.net/viewtopic.php?p=1293#p1293 dicussing this very topic and they have said years ago that PDF/A support is in their todo list, but nothing came of it. I cannot find any information about PDF/A format using these libraries. Do I

Rotate to landscape for first page when creating PDF

耗尽温柔 提交于 2019-12-11 01:44:44
问题 I want to rotate all pages in my document to landscape i tried: PdfWriter.GetInstance(mydoc, New FileStream(filename, FileMode.Create)) mydoc.Open() mydoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()) ... add rest of document and close ... but only my 2nd page is landscape, the first is portrait. 回答1: You need to change the page size before you open the document. The moment you invoke mydoc.Open() the first page is initialized and you can no longer change its rotation, size,... Also: if

Right Align part of a Chunk with iTextSharp

有些话、适合烂在心里 提交于 2019-12-11 01:27:12
问题 I´m new to iTextSharp and I´m trying to create a PDF. Just a simple example. If I do something like this: Paragraph p = new Paragraph(); p.Add(new Chunk("789456|Test", f5)); newDocument.Add(p); p.Add(new Chunk("456|Test", f5)); newDocument.Add(p); p.Add(new Chunk("12345|Test", f5)); newDocument.Add(p); I get this result: 789456|Test 456|Test 12345|Test What can I do to right align part of the text in my chunk. Like this: 789456|Test 456|Test 12345|Test Thanks in advance. 回答1: Please take a

Read/Modify PDF Metadata using iTextSharp without showing any data to user on pdf properties

我怕爱的太早我们不能终老 提交于 2019-12-11 01:13:53
问题 I am trying to use iTextSharp to read/modify PDF metadata. Without showing any information to the user. I gone through below code: iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 20f, 20f, 20f, 20f); using (MemoryStream memStream = new MemoryStream()) { using (PdfWriter wri = PdfWriter.GetInstance(document, memStream)) { document.Open(); document.AddSubject("Test"); document.Close(); } } I would greatly appreciate any pointers to the solution. 回答1

iTextSharp - very large table memory leak

ε祈祈猫儿з 提交于 2019-12-11 00:56:19
问题 I have a SqlDataReader reading a large record set (1M records approx.) and I'm trying to export it to a PDF document using iTextSharp. This is my code: if (reader.HasRows) { int rowNum = 0; while (reader.Read()) { if (rowNum % 2 == 1) datatable.DefaultCell.GrayFill = 0.8f; else datatable.DefaultCell.GrayFill = 0.95f; if (meRes.Trans(Lang, "Dir", CompanyID).ToUpper() == "RTL") for (int i = reader.FieldCount - 1; i >= 0; i--) { object o = reader[i]; datatable.AddCell(new Phrase(o.ToString(),

How to add paragraph wise texts separated by vertical line into itextsharp created PDF

笑着哭i 提交于 2019-12-11 00:54:15
问题 I have a requirement where i need to divide the newly created PDF file into two parts separated by vertical line.Now as per my requirement i have to add texts into the new PDF paragraph wise means at first all the records should go to paragraph one and one its over it should show into second paragraph from the top. Here is the code that i am trying to do with ,but i am getting vertical line in only half portion of the PDF.And i am totally unaware of how to add the texts paragraph wise. public