itextsharp

“Adding Enable for commenting Adobe Reader” using Acrobat

你说的曾经没有我的故事 提交于 2019-12-20 06:29:25
问题 I am using iTextSharp to create on PDF document, later i want to add "Adding Enable for commenting Adobe Reader" using Acrobat, but i getting error as You do not have permission to write to this file Here my code used to create PDF file: using (FileStream FS = new FileStream(dPDFFile_temp, FileMode.Create, FileAccess.Write, FileShare.None)) { using (Document Doc = new Document()) { using (PdfCopy writer = new PdfCopy(Doc, FS)) { Doc.Open(); for (int i = 1; i <= R.NumberOfPages; i++) { writer

How to set monospaced font by using iTextSharp?

坚强是说给别人听的谎言 提交于 2019-12-20 05:58:24
问题 This is how I managed my font so far: BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1250, BaseFont.EMBEDDED, false); Font titleFont = new Font(bf, 20); Now, I want to set monospaced (fixed width) font for purpose of string formatting. Do I have to download some ttf file (as I was reading about it) or there is monospaced font already included in iTextSharp 回答1: If you don't want to embed a font, you can use this: BaseFont bf = BaseFont.createFont( BaseFont.COURIER, BaseFont

How to check if a pdf page has a bookmark?

假装没事ソ 提交于 2019-12-20 05:55:51
问题 I'm trying to check if a page in a pdf file has a bookmark and what is in that bookmark, I'm using "iTextSharp.text.pdf" for reading and manipulating a pdf, but I can't find a way to check if a page has a bookmark or not. Pleas help Thanks! I've tried to get the bookmarks, but it gets me the all collection and i don't know how to get for a specific page it's bookmark, i used this code: public void Bookmarks(string pdfSourceFile) { PdfReader reader = new PdfReader(pdfSourceFile, new System

Issue when trying to remove inline images from PDF with iTextSharp

南笙酒味 提交于 2019-12-20 05:52:49
问题 I recently discovered iTextSharp. I was investigating a performance issue with the rendering of PDF documents and Bruno Lowagie (author of iText) kindly explained to me the reason why I was experiencing such an issue : it was due to the amount of "Inline Images" in my PDF documents. He also explained the basics to remove those "Inline Images"... (My purpose is to "possibly" show a preview of the document with a clear notice that it's not the actual document and that this one could be very

Which is the right method to text extraction strategy?

眉间皱痕 提交于 2019-12-20 05:46:07
问题 In my c# code I am extracting text from a pdf, and I have two methods of doing it. However 1 method works for 1 type of pdf document and the other method works for the other type of pdf document. When method 1 fails, I get the text but without any whitespaces, and when method 2 fails, I get only \r\n. Method 1 (class from http://www.codeproject.com/Articles/14170/Extract-Text-from-PDF-in-C-100-NET) PDFParser pdf_parser = new PDFParser(); currentText = pdf_parser.ExtractTextFromPDFBytes

Javascript to automatically supply password

北城余情 提交于 2019-12-20 05:43:35
问题 I have an application that displays password protected PDFs using iTextSharp. pdfCopy.SetEncryption(true, "Secretinfo", "Secretinfo", 0); If the user saves the PDF, the saved copy of the PDF is password protected. Which is great. The problem is it also prompts for password before displaying the PDF on the browser. Which isn't good. So I'm thinking maybe it's possible to supply the password using javascript just to display it on the browser. It's bad practice but I don't see that I have any

How to align content in columns using spacing, tabs or padding?

社会主义新天地 提交于 2019-12-20 05:40:05
问题 i'm trying to create a pdf looks like this but when i try string padding, it looks like this in pdf file here is the part of the c# code i tried. myExcelData is filled from excel file. for (int i = 0; i < 15; i++) { Chunk cSira = new Chunk((i + 1).ToString().PadRight(10), icerikFont); Chunk cHizmet = new Chunk(myExcelData.Tables[0].Rows[i][6].ToString().PadRight(80), icerikFont); Chunk cAdet = new Chunk(myExcelData.Tables[0].Rows[i][1].ToString().PadRight(10), icerikFont); Chunk cBirimFiyat =

pop-up a window from itextsharp annotation to display images and text

佐手、 提交于 2019-12-20 04:31:10
问题 I want to add and pop-up window in C# project to display an image and text by clicking on itextsharp annotation. iTextSharp.text.pdf.PdfAnnotation annot = iTextSharp.text.pdf.PdfAnnotation.CreateLink(stamper.Writer, c.rect, PdfAnnotation.HIGHLIGHT_INVERT, PdfAction.JavaScript("app.alert('action!')", stamper.Writer)); above code is used to display the alert and i want to customize it to my needs can someone please give me an option.i'm not familiar with javascript. or can i use any other

iTextSharp - Using PDFAction.GotoLocalPage in Merged PDF

本小妞迷上赌 提交于 2019-12-20 04:22:55
问题 I have written some code that merges together multiple PDF's into a single PDF that I then display from the MemoryStream. This works great. What I need to do is add a table of contents to the end of the file with links to the start of each of the individual PDF's. I planned on doing this using the GotoLocalPage action which has an option for page numbers but it doesn't seem to work. If I change the action to the code below to one of the presset ones like PDFAction.FIRSTPAGE it works fine.

How to keep original rotate page in itextSharp (dll)

风格不统一 提交于 2019-12-20 04:20:15
问题 i would like create the project, reading from Excel and write on pdf and print this pdf. From Excel file (from cell) read directory where is original pdf on computer or server, and next cell have info what write on the top in second pdf. And problem is here, original pdf is horizontal, landscape, rotate and my program create copy from original pdf and write info from excel on the top on copy pdf file. But pdf which is landscape is rotate for 270 deegres. This is no OK. For portrait rotation