itextsharp

ITextSharp and putting rich text in a specific position

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 10:18:15
问题 I have created a pdf document using Adobe LiveCycle. The problem I am facing is that I need to add some formatted text in a specific position on the document. How can I do that? overContent.BeginText(); overContent.SetTextMatrix(10, 400); overContent.ShowText("test"); This will only add basic text in the position specified and I really need to a linebreak, bullets, etc.. in the document. 回答1: I am using iText in Java and also ran into a similar situation. I was just trying to insert a simple

iTextSharp merge and preserve plugins

耗尽温柔 提交于 2019-12-24 07:46:22
问题 I have a PDF that has a plugin control on one page. I need to merge it with another pdf but when I do, the plugin is redendered as a blank rectangle. Is there a way to merge and preserve the plugin control? If important, the plugin is a Dessault Systemes 3D Via Composer Player control as installed from http://www.3ds.com/products/3dvia/3dvia-composer/resource-center/ The code I'm using is simple writer getinstance, contentbyte directcontent, getimportedpage, addtemplate. Nothing fancy.

How do I mark/unmark, write as Accepted/Rejected/Cancelled a text annotation using iTextSharp C#

99封情书 提交于 2019-12-24 05:54:44
问题 I'm working with iTextSharp on Visual Studio. I created a Pdfannotation like that: PdfAnnotation annotation = PdfAnnotation.CreateText(stamper.Writer, rect, "Author", "I write my text", true, "New Paragraph"); stamper.AddAnnotation(annotation, 1); So my annotation contents a text "I write my text". When I go on Adobe Acrobat Reader to open my pdf, and when I click on the button "Comment" to see all the comments I wrote on my pdf, I see my comment and near to my comment "I write my text", I

Using PdfStamper to add a rectangle

﹥>﹥吖頭↗ 提交于 2019-12-24 05:41:45
问题 Hi I have a pdf I created using itextsharp. Using pdfreader I am reading the created pdf into a pdfstamper. Now I am trying to use the pdfstamper to add a black rectangle the size of the page on all pages. How do i do this? Also I cannot use document to add the rectangle because the stream is close! MemoryStream stream = new MemoryStream(); PdfReader pdfReader = new PdfReader(output.ToArray()); PdfStamper stamper = new PdfStamper(pdfReader, stream); for (int x = 0; x < stamper.Reader

Alignment issue with multiline text form fields in iTextSharp

一世执手 提交于 2019-12-24 04:56:14
问题 I have written an application to programatically fill out a form in a PDF template from a database and save the result to disk. Everything is working correctly apart from any multi-line text fields which are not rendering as expected. They should be top, left aligned with no gaps between lines. The result I get is here : However, when I click into the form field using any PDF reader, the field corrects itself to what I would expect. See : The code I am using is pretty boiler plate stuff.

Spacing/Leading PdfPCell's elements

孤者浪人 提交于 2019-12-24 04:23:15
问题 Is it possible to add space between the elements of a cell (rows) in C#? I'm creating a pdf in visual studio 2012 and wanted to set some space between the rows. I have something like this: PdfPTable cellTable = new PdfPTable(1); PdfPCell cell= new PdfPCell(); for(i=0; i < 5; i++) { var titleChunk = new Chunk(tittle[i], body); var descriptionChunk = new Chunk(" " description[i], body2); var phrase = new Phrase(titleChunk); phrase.Add(descriptionChunk); cell.AddElement(phrase); } cellTable

Trying to convert plain text file to iTextSharp without losing format

可紊 提交于 2019-12-24 03:52:43
问题 I am trying to convert text files to PDF with iText Sharp. The conversion itself is not a problem however, I am unable to create the PDF file such that it looks exactly the way the text in the text file is aligned. This is the code I am using: public void GetPDF(string data) { using (MemoryStream ms = new MemoryStream()) { Rectangle docSize = new Rectangle(612, 798); Document myDocument = new Document(PageSize.A4.Rotate()); PdfWriter.GetInstance(myDocument, new FileStream ("MyNewPDF.pdf",

Creation of PDF file using itextSharp

南笙酒味 提交于 2019-12-24 03:18:32
问题 Hi I am creating an ASP.net website where some articles can be uploaded. I need that my users can get PDF version of it by clicking on a button. For this functionality I am using itextSharp. I am considering the following two options. 1. I will create the PDF file once(on first request) and reuse it always by checking for the existence of it. 2. I will create it on the fly and delete it as soon as the PDF file is delivered to the client. The first approach will lead to faster PDF delivery

itextsharp editor for creating tags

╄→尐↘猪︶ㄣ 提交于 2019-12-24 02:39:35
问题 I would like to know if exist some program for editing itextsharp code. Now I am writting code directly in VS lile: // Delivery address details int left_margin = 40; int top_margin = 720; writeText(cb, "Delivery address", left_margin, top_margin, f_cb, 10); writeText(cb, drHead["delCustomerName"].ToString(), left_margin, top_margin-12, f_cn, 10); writeText(cb, drHead["delAddress1"].ToString(), left_margin, top_margin-24, f_cn, 10); writeText(cb, drHead["delAddress2"].ToString(), left_margin,

Applying color to Strings in Paragraph using Itext

北城余情 提交于 2019-12-24 02:09:16
问题 I am combining 2 strings to Paragraph this way, String str2=""; String str1=""; ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(36, 600, 600, 800); ct.addElement(new Paragraph(str1 + str2)); int status1 = ct.go(); The problem is I am getting same font color for both str1 & str2. I want to have different font color and size for str1 & str2.. How Can i do that on ColumnText/Paragraph? Can someone help me in this... 回答1: When you combine text into a Paragraph like this: Paragraph p = new