itextsharp

itextsharp postscript to PDF

心已入冬 提交于 2019-12-02 09:11:20
问题 Is it possible to use itextsharp to convert postscript to a PDF ? If not is there another way to do it in .net ? 回答1: Converting PostScript to PDF is called "distilling". iText and iTextSharp do not support distilling. Ghostscript will be your only FOSS solution. 回答2: You could use Ghostscript as it's explained here: http://hi.baidu.com/lqyidxa_igfv/blog/item/df2037b394539fa0d9335a94.html 来源: https://stackoverflow.com/questions/4970511/itextsharp-postscript-to-pdf

How can I lock a PDF document after signing it?

自作多情 提交于 2019-12-02 09:08:07
问题 Adobe Acrobat has the option to lock the PDF document after signing it. This changes the document permissions so that Acrobat does not offer signing the document again or modifying annotations or forms. This seems like a reasonable action to do after a document has been signed for review by multiple entities and finally for release by someone responsible. iTextSharp can also sign documents, and it can also add further signatures to an already signed document. iTextSharp basically also can set

Set font for all text from Pdfptable with Itextsharp

末鹿安然 提交于 2019-12-02 09:04:32
var htmlarraylist = HTMLWorker.ParseToList(new StringReader(htmlText), styles); document.Open(); BaseFont Vn_Helvetica = BaseFont.CreateFont(@"C:\Windows\Fonts\arial.ttf", "Identity-H", BaseFont.EMBEDDED); Font fontNormal = new Font(Vn_Helvetica, 12, Font.NORMAL); foreach (var t in htmlarraylist) { if (t is PdfPTable) { //how set fontNormal all text from Pdfptable ? } document.Add((IElement)t); } document.Close(); Can someone help me please Please try by setting font to the PdfPTable.DefaultCell property in you foreach loop Example: t.DefaultCell.Phrase = new Phrase() { Font = fontNormal }; 来源

Rotating in Itextsharp while preserving comment location & orientation

陌路散爱 提交于 2019-12-02 09:03:22
问题 To summarize, I'm using Itextsharp to import specific pages from a PDF, possibly rotate, resize or otherwise alter that page, and exporting it into a new PDF. To this end I'm using the PDFWriter class from Itext. The problem I'm running into is that when using the writer class, it doesn't appear to be including the visible annotations that appear on the source page (in my case it's a comment) in the output page. Interestingly it does include the embedded OCR without issue. Additionally, when

Load basefont from resource

我们两清 提交于 2019-12-02 08:58:31
I'm trying to use ITextSharp and load a font file inserted in my project as resource. I try different solutions but none of them seems to work, here a sample of what I did: this one cannot load the resource private static BaseFont _bfArial; public static BaseFont BfArial { get { if (_bfArial == null) _bfArial = BaseFont.CreateFont(@"Resources\Images\arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); return _bfArial; } } this one gives me an error: "'Identity-H' is not a supported encoding name." private static BaseFont _bfCourier; public static BaseFont BfCourier { get { if (_bfCourier ==

“Adding Enable for commenting Adobe Reader” using Acrobat

£可爱£侵袭症+ 提交于 2019-12-02 08:56:37
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.AddPage(writer.GetImportedPage(R, i)); } Doc.Close(); } } } You are asking something that is impossible

iTextSharp: Why when adding a image to a pdf page the text font is different?

老子叫甜甜 提交于 2019-12-02 08:51:55
I use Helvetica font and 14 px size for text. The problem is that if a page does not have any image on it the text is very clear, but in a page with at least 1 image the text is getting a little bold. You can see what I mean in images below: * Without image on page * With image on page The correct font is the one that appear in picture #1. How to make all pages have the same font even if the page contains an image or not? Thanks. Sample code: Document document = new Document(PageSize.LETTER); document.SetMargins(docMargin, docMargin, docMargin, 25); writer = PdfWriter.GetInstance(document, new

Change Background Image in Itext to watermark or alter opacity c# ASP.net

核能气质少年 提交于 2019-12-02 08:44:28
问题 I want to make my background image in iText transparent here is my code for the image: string root = Server.MapPath("~"); string parent = Path.GetDirectoryName(root); string grandParent = Path.GetDirectoryName(parent); string imageFilePath = parent + "/Images/logo.png"; iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath); jpg.ScaleToFit(1700, 800); jpg.Alignment = iTextSharp.text.Image.UNDERLYING; jpg.SetAbsolutePosition(100, 250); jpg.ScaleAbsoluteHeight(500); jpg

Which is the right method to text extraction strategy?

我与影子孤独终老i 提交于 2019-12-02 08:37:57
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(pdfReader.GetPageContent(page)) + " "; Method 2 StringWriter output = new StringWriter(); for (int i = 1; i

Unable to Export HTML Markup to PDF using iTextSharp API in asp.net using C#?

强颜欢笑 提交于 2019-12-02 08:29:51
I have an HTML markup which has HTML Table and Images in it. I am using iTextSharp API to convert the HTML markup to PDF . But, unfortunately the iTextSharp fails to export the HTML markup containing the Images & Table to PDF. Error:The network path was not found. Result must be: Code: using iTextSharp.text; using iTextSharp.text.pdf; using iTextSharp.text.html; using System.Data.SqlClient; using System.Text; using iTextSharp.text.html.simpleparser; public string strSelectUserListBuilder = @" <div style='width: 50%; border: 1 solid #000000; padding-bottom: 100; padding-left: 100; padding-right