itextsharp

How to set the cell width in itextsharp pdf creation in MVC4 Razor

蓝咒 提交于 2019-12-12 05:18:10
问题 Here im try to set a table cell width using itextsharp pdf creation but im facing trouble to make it since im using html table as string my code: public ActionResult FormSixteen(EmployeeFormSixteenModel objEmployeeFormSixteenModel) { string htmlTable = string.Empty; htmlTable = htmlTable + "<table><tr><td>S.no</td><td>Head Name</td>Amount<td></td></tr><tr><td>1</td><td>Gross Salary</td>xxxx<td></td></tr></table>"; Document document = new Document(); Response.ContentType = "application/pdf";

ITextSharp taking too much time in getting Number of Pages

六月ゝ 毕业季﹏ 提交于 2019-12-12 05:15:59
问题 I have this piece of code: foreach(string pdfFile in Directory.EnumerateFiles(selectedFolderMulti_txt.Text,"*.pdf",SearchOption.AllDirectories)) { //filePath = pdfFile.FullName; //string abc = Path.GetFileName(pdfFile); try { //pdfReader = new iTextSharp.text.pdf.PdfReader(filePath); pdfReader = new iTextSharp.text.pdf.PdfReader(pdfFile); rownum = pdfListMulti_gridview.Rows.Add(); pdfListMulti_gridview.Rows[rownum].Cells[0].Value = counter++; //pdfListMulti_gridview.Rows[rownum].Cells[1]

Make ListItem Text Bold but not the List Icon itextsharp

限于喜欢 提交于 2019-12-12 05:08:35
问题 I am displaying a list using itextsharp in a pdf file . Some of the Contents in a List item are being Bold as I asked it in my Question : Bold some text in Pdf List Now the problem is if I bold some text of Listitem , the List number is also getting Bold. For Example : 1.Bold Text it should be Bold Text Here is the Snapshot : How can I resolve this ? Here is my Code : c1 = new Chunk("Earth Pit.", FontFactory.GetFont(FontFactory.TIMES_BOLD, 10,iTextSharp.text.Font.UNDERLINE)); c2 = new Chunk("

iTextSharp SetField for fields with same name on different pages

天大地大妈咪最大 提交于 2019-12-12 04:56:14
问题 I used acroFields.GetTranslatedFieldName() to get the next fieldnames from the pdf: topmostSubform[0].Page1[0].CheckBox2A[0] topmostSubform[0].Page1[0].CheckBox2A[1] topmostSubform[0].Page2[0].CheckBox2A[0] topmostSubform[0].Page2[0].CheckBox2A[1] topmostSubform[0].Page3[0].CheckBox2A[0] topmostSubform[0].Page3[0].CheckBox2A[1] I use the next line of code to fill CheckBox2A[0] on the second page. fields.SetField("topmostSubform[0].Page2[0].CheckBox2A[0]", "1") Instead of CheckBox2A[0] on the

Sign PDF file on last page

ぐ巨炮叔叔 提交于 2019-12-12 04:49:45
问题 I am using C# and iTextSharp 3.1 to sign PDF files. The signing is working, but I want to sign on the last page of the file. The code I use is such : reader = new PdfReader(inputPDF); int numberOfPages = reader.NumberOfPages; PdfStamper st = PdfStamper.CreateSignature(reader, new FileStream(outputPDF, FileMode.Create, FileAccess.Write), '\0', null, true); PdfSignatureAppearance sap = st.SignatureAppearance; if (logoSign != null) { // Scale img to fit logoSign.ScaleToFit(100, 50); // Set

PdfReaderContentParser.ProcessContent returns whitespace for clear text

旧城冷巷雨未停 提交于 2019-12-12 04:09:47
问题 I'd like to parse a pdf for texts containing both, binary and clear text data. When I try to do it with PdfReaderContentParser the GetResultantText method returns the right texts for the binary content but whitespaces for the clear text content. Here is the code I use: byte[] binaryPdf = File.ReadAllBytes(this.fileName); reader = new PdfReader(binaryPdf); PdfReaderContentParser parser = new PdfReaderContentParser(reader); for (int i = 1; i <= reader.NumberOfPages; i++) {

How to embed a .nav file into pdf portfolio?

拟墨画扇 提交于 2019-12-12 03:56:46
问题 I am new here and new to iTextsharp. I have successfully created a pdf portfolio file and displayed it on browser. The default layout is details or custom. And my boss hopes to add some layout for it, like click-through or revolve. Does anyone know how to do it? I will appreciate your help! Should I embed the .nav file into pdf portfolio or create a navigation by myself? I don't know how? 回答1: .nav files are described in the Adobe extensions to ISO-32000-1 (level 3) as described on page 541

iText signing PDF using external signature with smart card

自作多情 提交于 2019-12-12 03:55:56
问题 I've been toying with iTextSharp 5.5.7 for a while and can't find the right way to make a valid digital signature for PDF from Smart Card - Adobe Reader always says its signed by and unknown and can't decode signatures' DER data. I've looked at MakeSignature.cs code for reference and what is does: Stream data = signatureAppearance.GetRangeStream(); // gets the first hash byte[] hash = DigestAlgorithms.Digest(data, hashAlgorithm); // gets the second hash or is it not a hash at all ? byte[] sh

Trying to use PdfStamper and MemoryStream to add data to existing PDF then email it

﹥>﹥吖頭↗ 提交于 2019-12-12 03:38:40
问题 Here is my chunk of code. It compiles fine and when I fire off the event I get the email, but I then get this error Email attachment ERROR on Adobe while opening(Acrobat could not open 'Att00002.pdf' because it is either not a supported file type or because the file has been damaged(for example, it was sent as an email attachment and wasnt correctly decoded.) string agentName = "My Name"; MemoryStream _output = new MemoryStream(); PdfReader reader = new PdfReader("/pdf/Agent/Specialist

Embedding font using itext 5 for PDF/UA compliance

坚强是说给别人听的谎言 提交于 2019-12-12 03:29:31
问题 We are currently building a proof of concept to generate PDF/UA compliant PDF from from a CSS and html (xhtml) file using xslt. We are able tag the PDF and add the appropriate metadata information. The last major issue we are unable to solve is embedding a standard PDF font zapfdinbats, which our accessibility assessment tool complains about - using PAC 2.0 along with adobe DC built in checker. As you can see from the image below the other fonts we are using seems automatically get embedded