itextsharp

iTextSharp custom paper size

倾然丶 夕夏残阳落幕 提交于 2020-01-02 13:33:10
问题 I'm using iTextsharp library to create PDF files. I can declare for A4 Landscape paper like this: Dim pdfTable As New PdfPTable(9) pdfTable.WidthPercentage = 100 Dim pdfDoc As New Document(PageSize.A4.Rotate()) I'm wondering how I can set Height of pdfTable or A4 Height manually. Because there's a lot more margin left at the bottom, and I need to put some text at that margin. Right now, I put a line of text at the bottom, the line's got pushed to the new page. Q1: How can I override the

iTextSharp 5.5.6.0 Bug? check box tick mark changes

守給你的承諾、 提交于 2020-01-02 06:28:13
问题 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. The document has PdfVersion of 54 '6'. I have tried: SetFieldProperty(fieldname, "checkboxtype", RadioCheckField.TYPE_CHECK, null); but with no luck. Also I searched for the potential property list, but cannot seem to find a list of valid string values. Is the iText in Action ->

实战 iTextSharp

与世无争的帅哥 提交于 2020-01-01 22:35:25
iTextSharp 是用来生成 PDF 的一个组件,在 1998 年夏天的时候,Bruno Lowagie ,iText 的创作者,参与了学校的一个项目,当时使用 HTML 来生成报告,但是,使用 HTML 打印的效果很不理想。最后,他发现,使用 PDF 可以完美解决打印问题,为了能够在各个系统中使用,iText 组件库诞生了。 最初的 iText 主要是支持 Java 語言。之後針對Microsoft .NET C Sharp做了一個版本,也就是我們今天要介紹的 iTextSharp。 目前,iTextSharp 的版本是 5.1.2,下载地址: http://sourceforge.net/projects/itextsharp/files/ 其中主要包含了核心组件:itextsharp.dll 但是,直接使用它并不能处理中文,你还要下载两个组件。 在下载页面中,注意图中标注的 extras 文件夹。 点击之后,可以看到如下的下载: 注意把标注的两个压缩包下载下来,这是使用中文的关键。解开两个压缩之后可以看到下面的两个文件。 iTextAsianCmaps.dll iTextAsian.dll 在创建的项目中,将这三个程序集都添加到项目的引用中。 // 必须先加入资源 BaseFont.AddToResourceSearch("iTextAsian.dll");

iTextSharp - How to input image (PNG) from project resource?

耗尽温柔 提交于 2020-01-01 15:56:08
问题 I have iTextSharp creating a pdf for me in VB.net. Everything was working famously, except now I want to embed an image. I tried this: Dim test = My.Resources.MyImage Dim logo = Image.GetInstance(test) This an error though: 'GetInstance' cannot be called with these arguments It appears as though it expects a path, and is getting a System.Drawing.Bitmap type. Is there any way that I can add a project resource image to my PDF? Thanks in advance! 回答1: One of the overloads for iTextSharp.text

Rotate text / Vertical text in itextsharp

杀马特。学长 韩版系。学妹 提交于 2020-01-01 08:53:06
问题 I need vertical text or just a way to rotate a ColumnText in ITextSharp. (It needs to be absolute position) Until now i have tried a lot of diffrent solution, but with no luck. Here is a couple of tries: 1. _cb.SetFontAndSize(BaseFont.CreateFont(), 12f); _cb.ShowTextAligned(Element.ALIGN_CENTER, "Hello World", 50, 50, 90); 2. var vt = new VerticalText(_cb); vt.SetVerticalLayout(50, 50, 400, 8, 30); vt.AddText(new Chunk("asdasd",_sf.ChildBackPageTextOneFont())); vt.Go(); 3. System.Drawing

Disable Adobe Reader toolbar from my ActiveX

半世苍凉 提交于 2019-12-31 04:59:45
问题 I am loading a PDF document in my ActiveX using AxAcroPDFLib and iTextSharp libraries. I want to disable the toolbar (that have Save, Print etc options) from the loaded PDF so that user cannot 'Save' the PDF from ActiveX. I have following code: axAcroPDF1.Width = someWidth; axAcroPDF1.Height = someHeight; axAcroPDF1.LoadFile(documentPath); axAcroPDF1.setPageMode("none"); axAcroPDF1.setShowToolbar(false); axAcroPDF1.Show(); axAcroPDF1.Focus(); The axAcroPDF1.setShowToolbar(false) disables the

Document.NewPage() not adding new page

时光怂恿深爱的人放手 提交于 2019-12-31 04:28:26
问题 I am trying to add a new page to a pdf document, however for some reason this is not happening. Maybe my other question https://stackoverflow.com/questions/11428878/itextsharp-splitlate-not-working has something to do with this since the table in this question does not break and no new pages are created. This is the code I have for the adding of new pages: Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4.Rotate(),20,20,20,40); string rep1Name; // variable to hold the

A number is out of range error while Highlighting PDF File using itextsharp

泪湿孤枕 提交于 2019-12-31 04:20:29
问题 I highlighted the word in pdf using the code in the answer to the following question: [Highlight words in a pdf using itextsharp, not displaying highlighted word in browser]2 But i got "A number is out of range error" when open this pdf. private void hightlightPDFText() { try { string[] highlightText = new string[] { "EXTENSIONAL", "geology" }; string inputFile = Server.MapPath("~/pdf/") + "101111j174754572003tb00036x.pdf"; string outputFile = Server.MapPath("~/pdf/") +

PDF coordinate system in iTextSharp

橙三吉。 提交于 2019-12-31 03:58:09
问题 Now I'm working on extracting line and rectangle from PDF by using iTextSharp. The method I used is as below: PdfReader reader = new PdfReader(strPDFFileName); var pageSize = reader.GetPageSize(1); var cropBox = reader.GetCropBox(1); byte[] pageBytes = reader.GetPageContent(1); PRTokeniser tokeniser = new PRTokeniser(new(RandomAccessFileOrArray(pageBytes)); PRTokeniser.TokType tokenType; string tokenValue; CoordinateCollection cc = new CoordinateCollection(); while (tokeniser.NextToken()) {

add header, footer and Background color to pdf cells in iTextSharp

你。 提交于 2019-12-31 03:07:08
问题 im using iTextSharp for PDF Doc creater. i want to add header which is a text and a line below it and then the table to appear. the footer should contain the page number at the bottom right. im able to create the table but the header and footer seems to be an issue. can someone give an example code to solve this issue. also i want to color the header columns in the table i.e the heading columns of only the first row to have a background color. im new to this so please help me out. thanks in