itextsharp

ITextSharp Bug? - Null reference when stamping certificate protected pdf

雨燕双飞 提交于 2019-12-24 23:32:48
问题 I'm using ITextSharp's PdfStamper to fill in a pdf form. This works for unprotected and password protected Pdfs, but certificate protected PDFs cause a null reference exception when calling PdfStamper.Close() . Has anyone come across this before? Example failing program: using System.Security.Cryptography.X509Certificates; using iTextSharp.text; using iTextSharp.text.pdf; using System.IO; using Org.BouncyCastle.Crypto; using X509Certificate = Org.BouncyCastle.X509.X509Certificate; namespace

itextsharp setting the stamper FormFlatttening=true results in no output

杀马特。学长 韩版系。学妹 提交于 2019-12-24 21:40:00
问题 Using itextsharp v5.5.5.0 in VS2010 Setting the stamper FormFlattening = true no filed data is written to the output pdf. If set false the data is all present & correct but still editable (which I don't want) PdfReader pdfTemplate = new PdfReader("..\\..\\pdf\\BFC-Template.pdf"); FileStream fileOutputStream = new FileStream("..\\..\\pdf\\BFC.pdf", FileMode.Create); PdfStamper stamper = new PdfStamper(pdfTemplate, fileOutputStream); stamper.AcroFields.SetField("FitID", "1234"); stamper

itextsharp: getting coordinates of image

戏子无情 提交于 2019-12-24 20:12:59
问题 in vb.net is it possible to get the coordinates of an image like if i do a document.add (jpeg_image) x_coordinate = jpeg_image.xcoordinate??????? 回答1: If you're trying to get this info while you are building the PDF document: The x-coordinate of the left edge of your image will depend on how the image was added to the PDF document. If you use an absolute position to add it, you'll have your x-coordinate. If you just add it, without absolute position, or any other modifiers, the x-coordinate

How create PDF/A file from HTML using iTextSharp

流过昼夜 提交于 2019-12-24 19:29:12
问题 I want to create PDF/A from HTML using iTextsharp, but is having a hard time creating something that validateds to PDF/. This is the code that I use to test the functionality. What needs to be changed to get what I want? static void Main(string[] args) { //create stylesheet (used to change font from default Helvetica in order to embed font in PDF/A) var styles = new StyleSheet(); var fontPath = Environment.GetEnvironmentVariable("SystemRoot") + "\\fonts\\verdana.ttf"; FontFactory.Register

Read roman page number of page

ε祈祈猫儿з 提交于 2019-12-24 17:15:37
问题 in Adobe Reader the first pages of a ebook can have roman format page number as shown in attached image below Image : http://i.stack.imgur.com/GSm0Q.jpg I would like to read these page numbers out (not the indexed page number) with iText but I don't know which properties (labels or annotations..) I should use. I could already open file with PdfReader, loop through all pages but have no idea what I should access for these roman numbers using (Stream pdfStream = new FileStream(sourceFileName,

ColumnText and truncate issue

三世轮回 提交于 2019-12-24 17:06:05
问题 I am currently using ITextSharp, and following along with IText in Action Second edition, specifically page 74 working with the ColumnText object. I am loading a PDF file using the PDFReader and PDFStamper classes, and trying to add multiple Elements in the PDF document. PdfStamper pdfStamper = new PdfStamper(pdfReader, fileStream); PdfContentByte canvas = pdfStamper.GetOverContent(1); Rectangle size = pdfReader.GetPageSizeWithRotation(1); ColumnText ct = new ColumnText(canvas); //I have

Apply Formatting to pdf bookmarks using itextsharp

霸气de小男生 提交于 2019-12-24 16:43:10
问题 This is further to my question Add Page bookmarks to an existing PDF using iTextSharp using C# code With the guidence of Bruno Lowagie i managed to add pdf bookmarks using iTextShrp, but now i need to add color and bold formatting to the bookmarks. Please help... I am sure that it is possible , becuase i used ExportToXML to retrieve an already formatted bookmark, then it is having formatting info as well. 回答1: Just like in my previous answer, I would like you to please read the documentation.

iTextSharp: Javascript in PDF not firing when filled in in vb.Net

左心房为你撑大大i 提交于 2019-12-24 16:14:50
问题 I use iTextSharp to fill in the PDF server-sided and return it so that the client can download it. Here's the link to the pdf. The problem is number 1. You can only fill in the PDF if you have one of the boxes checked. If none is checked, everything will be "empty". The content isn't removed and returns once a box has been checked. Everything gets populated, but there is a problem. The checkbox gets checked, but the Javascript behind it doesn't fire. Any solutions? 回答1: When you use iText

How can I assign the contents of an iTextSharp.text.Document to either a byte array or a Memory Stream?

我的未来我决定 提交于 2019-12-24 15:51:59
问题 I have working code in an ASP.NET Web API app that downloads an Excel spreadsheet / .xls file to the user's machine when this method is called via a click on a link: public HttpResponseMessage Get(string unit, string begindate, string enddate) { byte[] excelContents; string selectStmt = "SELECT BinaryData FROM ReportsGenerated WHERE FileBaseName = @fileBaseName"; string fbn = string.Format("deliveryperformance/{0}/{1}/{2}", unit, begindate, enddate); using (SqlConnection connection = new

Setting BaseFont parameters back to default after bold

时间秒杀一切 提交于 2019-12-24 14:38:38
问题 I am using absolute positioning when writing text in a PDF document using iTextSharp. It can only deal with BaseFont and it is not possible to set a Bold decoration on a base font. I read in a post that this was the way to set the font to bold: pdfContentByte.SetCharacterSpacing(1); pdfContentByte.SetRGBColorFill(66, 00, 00); pdfContentByte.SetLineWidth((float)0.5); pdfContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); That worked but created a another problem. I