itextsharp

How can convert XML to PDF using iTextSharp?

你离开我真会死。 提交于 2019-12-04 18:52:55
How can convert XML to PDF using iTextSharp? the iTextSharp's current XML to PDF is clearly out of date and does not work. So I went about fixing the problem but i am not been able to covert it Can any one help me. <?xml version="1.0" encoding="utf-8" ?> <catalog> <cd> <SR.No>14</SR.No> <test>loss test</test> <code>ISO-133</code> <unit>gm</unit> <sampleid>36</sampleid> <boreholeid>21</boreholeid> <pieceno>63</pieceno> </cd> <cd> <SR.No>24</SR.No> <test>sand</test> <code>ISO-133</code> <unit>gm</unit> <sampleid>71</sampleid> <boreholeid>22</boreholeid> <pieceno>23</pieceno> </cd> <cd> <SR.No>25

Append PDF to a Signed PDF

邮差的信 提交于 2019-12-04 18:45:39
I need to append a pdf file to a digital signed pdf file, keeping valid the signature ...maybe using revision? ...using iTextSharp? How can I do it? Please help me with some sample. You can't as that invalidates the whole point of digital signatures, namely to detect when something exactly as you describe occurs and therefore ensure the validity of the original document. To do as you want, you will need to add the extra PDF to the unsigned original PDF and then resign the new conglomerate PDF. You can use Increment Update to do that, as long as the original signature allows you. Take look at

How to Detect table start in itextSharp?

六月ゝ 毕业季﹏ 提交于 2019-12-04 18:35:24
I am trying to convert pdf to csv file. pdf file has data in tabular format with first row as header. I have reached to the level where I can extract text from a cell, compare the baseline of text in table and detect newline but I need to compare table borders to detect start of table. I do not know how to detect and compare lines in PDF. Can anyone help me? Thanks!!! Chris Haas As you've seen (hopefully), PDFs have no concept of tables, just text placed at specific locations and lines drawn around them. There is no internal relationship between the text and the lines. This is very important

how to apply font properties on <span> while passing html to pdf using itextsharp

时光总嘲笑我的痴心妄想 提交于 2019-12-04 18:13:49
I am converting html to pdf using itextsharp and I want to set the font size for tags. How can I do this? Currently I am using: StyleSheet styles = new StyleSheet(); styles.LoadTagStyle(HtmlTags.SPAN, HtmlTags.FONTSIZE, "9f"); string contents = File.ReadAllText(Server.MapPath("~/PDF TEMPLATES/DeliveryNote.html")); List parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), styles); But it didn't work. The constants listed in HtmlTags are actually a hodgepodge of HTML tags and HTML and CSS properties and values and it can be a little tricky sometimes figuring out what to use.

Comparing a signed PDF to an unsigned PDF using document hash

谁说我不能喝 提交于 2019-12-04 17:48:40
问题 After extensive google searches, I'm starting to wonder if I'm missing the point of digital signatures in some way. This is fundamentally what I believe I should be able to do in principle, and I'm hoping iTextSharp will allow me: I'm writing in C# and .NET and using iTextSharp to parse PDF files. I have an unsigned PDF file, and also a signed version of the same file. I'm aware a digital signature fundamentally hashes the PDF data, encrypts it with a private key, and then part of the

Changing font size in itextsharp table

血红的双手。 提交于 2019-12-04 16:11:20
Im attempting to view a table in a PDF file using iTextSharp. I've figured out how to add the table, and make the PDF file open off a button click, but the table font is too big, and words are wrapped making them hard to read. I've entered this code, but nothing happens to the tables font. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlServerCe; using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; namespace Lewis_Warby

C# 3.0 Save itextsharp pdf to database using MemoryStream

Deadly 提交于 2019-12-04 14:55:33
I'm trying to save to databse a pdf file generated by itextsharp. But, I haven't been successfully so far. I'm using Linq to sql. Here's the code: MemoryStream ms = new MemoryStream(); Document d = new Document(PageSize.A4, 60, 60, 40, 40); PdfWriter w = PdfWriter.GetInstance(d, ms); w.CloseStream = false; string txtTemplate = ""; Encoding en = Encoding.GetEncoding("iso-8859-1"); StreamReader sr = new StreamReader(HttpContext.Current.Server.MapPath("~/Content/templates/CessaoDireitosDica.txt"), en); txtTemplate = sr.ReadToEnd(); sr.Close(); string conselhos = ""; Font font = new Font(Font

iTextSharp Html to Pdf image src

倖福魔咒の 提交于 2019-12-04 13:18:44
问题 Convert a html to pdf using iTextSharp public static MemoryStream CreatePdfFromHtml( string html, List<Attachment> attachments) { MemoryStream msOutput = new MemoryStream(); using (TextReader reader = new StringReader(html)) using (Document document = new Document()) { PdfWriter writer = PdfWriter.GetInstance(document, msOutput); document.Open(); foreach (var a in attachments) { var image = iTextSharp.text.Image.GetInstance(a.File); document.Add(image); } XMLWorkerHelper.GetInstance()

How To Adjust Font Size To Fill A Fixed Height Table Cell In iTextSharp

谁都会走 提交于 2019-12-04 13:12:25
I am creating a PDF from iTextSharp for printing. I have varible length text that I would like to always be in the maximum font size to fill a fixed height table cell without wrapping out of sight. How can this be done? You need to start by being able to measure the width of your text in the font that you have chosen. From the iTextSharp documentation: Measuring text Sometimes it's necessary to know the length of a certain piece of text. If you have created a BaseFont object, you can use the method: public float getWidthPoint(String text, float fontSize); So if you are using some barcode font

iTextSharp - How to input image (PNG) from project resource?

白昼怎懂夜的黑 提交于 2019-12-04 12:42:12
I have iTextSharp creating a pdf for me in VB.net. Everything was working famously, except now I want to embed an image. I tried this: Dim test = My.Resources.MyImage Dim logo = Image.GetInstance(test) This an error though: 'GetInstance' cannot be called with these arguments It appears as though it expects a path, and is getting a System.Drawing.Bitmap type. Is there any way that I can add a project resource image to my PDF? Thanks in advance! One of the overloads for iTextSharp.text.Image.GetInstance() takes an System.Drawing.Image , so convert your PNG resource into this type and then use