itextsharp

C# 3.0 Save itextsharp pdf to database using MemoryStream

只谈情不闲聊 提交于 2019-12-06 07:24:07
问题 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"

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

不羁的心 提交于 2019-12-06 06:39: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? 回答1: 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

How to read a PDF Portfolio using iTextSharp

匆匆过客 提交于 2019-12-06 06:31:20
I'm using iTextSharp, in a C# app that reads PDF files and breaks out the pages as separate PDF documents. It works well, except in the case of portfolios. Now I'm trying to figure out how to read a PDF portfolio (or Collection, as they seem to be called in iText) that contains two embedded PDF documents. I want to simply open the portfolio, enumerate the embedded files and then save them as separate, simple PDF files. There's a good example of how to programmatically create a PDF portfolio, here: Kubrick Collection Example But I haven't seen any examples that read portfolios. Any help would

Why is my image distorted when decoding as FlateDecode using iTextSharp?

不打扰是莪最后的温柔 提交于 2019-12-06 06:03:22
问题 When decoding an image within a PDF as FlateDecode via iTextSharp the image is distorted and I can't seem to figure out why. The recognized bpp is Format1bppIndexed . If I modify the PixelFormat to Format4bppIndexed the image is recognizable to some degree (shrunk, coloring is off but readable) and is duplicated 4 times in a horizontal manner. If I adjust the pixel format to Format8bppIndexed it is also recognizable to some degree and is duplicated 8 times in a horizontal manner. The image

x and y coordinate of text using itextsharp

怎甘沉沦 提交于 2019-12-06 06:03:21
问题 When i extract text using itextsharp, i will get x and y coordinate of text. By using these 2 coordinates if i convert text from pdf to html based on x y position the text position chnages . to get x ,y coordinates i used Vector curBaseline = renderInfo.GetBaseline().GetStartPoint(); float x=curBaseline[Vector.I1]; float y= curBaseline[Vector.I2]; for example : when i extract text using above method say x=42 and y=659; " < span style=left:{0}px;bottom:{1}px;position:relative;\">",curBaseline

Verify if a PDF is secured/protected with iTextSharp

别等时光非礼了梦想. 提交于 2019-12-06 05:51:48
问题 Is it possible to verify if we can copy the content of a PDF document with iTextSharp? I have a method that copy the content of the PDF and add a new page at the end with project's information but it throw a "System.ArgumentException: PdfReader not opened with owner password". I get this error when I do writer.GetImportedPage(reader, i); Thanks for the help! 回答1: You should be able to just check the property PdfReader.IsOpenedWithFullPermissions . PdfReader r = new PdfReader("YourFile.pdf");

Adding text to existing pdf which is closed using itextsharp

冷暖自知 提交于 2019-12-06 05:44:12
问题 Hi I am creating PDF using itextsharp. Now my requirement is to add more text to the existing pdf. Is it possible if so then how can I do that? Thanks Dipa 回答1: Yes, with certain limitations. It is difficult, but not impossible, to determine what is already on an existing page. If all you want to do is add "page X of Y" to the bottom left corner of all your pages, that's easy . PdfReader reader = new PdfReader( inPath ); PdfStamper stamper = new PdfStamper( reader, new FileOutputStream(

iTextSharp 5.5.6 enters a cross symbol when Check Type Style is Check Mark

南笙酒味 提交于 2019-12-06 05:29:57
问题 This question was asked previously (iTextSharp 5.5.6.0 Bug? check box tick mark changes) but with no answer supplied, I cannot comment because I am a new user. I am having exactly the same issue. I have an existing PDF that I am filling in programmatically (C#). There are check boxes on the form. In build 4.4.x they rendered a check mark when selected. In build 5.5.5.0 and 5.5.6.0 they are now a cross symbol. Don't think setting the property would have any effect as already set to this in the

How to create “reply” to sticky note annotation in iText

℡╲_俬逩灬. 提交于 2019-12-06 05:28:36
I trying to create "reply" to sticky note annotation using iText, does anyone know how to do that? Another question: how to modify the date of annotation? Taking a look at the innards of just such an annotation, I see the following: A new text note annotation with the same bounding box A new popup annotation with the same bounding box The new text annot has an IRT (in regards to?) key in its dictionary that is an indirect reference to the first text annotation. The creation date is stored in the "CreationDate" key, the modification date is stored under "M". The text displayed where you see

How to read a PDF file line by line in c#?

て烟熏妆下的殇ゞ 提交于 2019-12-06 05:22:57
问题 In my windows 8 application, I would like to read a PDF line by line then I would like to assign a String array. How can I do it? public StringBuilder addd= new StringBuilder(); string[] array; private async void btndosyasec_Click(object sender, RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.List; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".pdf"); StorageFile file = await