itext

Itext 7 overriding default margin in pdfHtml

一个人想着一个人 提交于 2019-12-20 06:14:04
问题 I have html content that has to start at the absolute top left corner of the page. However, the HtmlConverter automatically adds a 0.5in gap from the top and left side of the pdf page. How do I override this default margin? 回答1: You can set the margins of a page through CSS using @page. The following declaration sets all the page-margins to 0, as well as draws a border around paragraphs for visual reference: @page{ margin:0pt; } p{ border-left: solid 2pt blue; border-top: solid 1pt blue;

Itext 7 overriding default margin in pdfHtml

别来无恙 提交于 2019-12-20 06:13:04
问题 I have html content that has to start at the absolute top left corner of the page. However, the HtmlConverter automatically adds a 0.5in gap from the top and left side of the pdf page. How do I override this default margin? 回答1: You can set the margins of a page through CSS using @page. The following declaration sets all the page-margins to 0, as well as draws a border around paragraphs for visual reference: @page{ margin:0pt; } p{ border-left: solid 2pt blue; border-top: solid 1pt blue;

Adding a row to a table in PDF using iText

拈花ヽ惹草 提交于 2019-12-20 06:03:06
问题 What I'm getting in this code is a table with 8 columns and 3 rows. What should I do to get just 2 rows? And the 1st column in the 3 rows are empty, but the remaining cells are filled with "hi". Code: PdfPTable table = new PdfPTable(8); PdfPCell cell; cell = new PdfPCell(); cell.setRowspan(2); table.addCell(cell); for(int aw=0;aw<8;aw++){ table.addCell("hi"); } 回答1: Try this: PdfPTable table = new PdfPTable(8); PdfPCell cell; for(int aw=0;aw<8;aw++) { cell = new PdfPCell(new Paragraph("hi"));

Post Back not occuring after pdf is downloaded

江枫思渺然 提交于 2019-12-20 05:37:15
问题 I've developed a pdf file using itextsharp. Pdf generation is working fine. After the pdf is created it's being downloaded. My problem is when the user clicks on Generate PDF button , Pdf is generated and downloaded properly but postback doesn't occurs. I want the postback to be occured because I want to Reset my Form after Pdf is generated that is Clear All Fields . How Can I do this ? Here is my code : Method to Generate PDF : public void GetPDF(string quote_num) { string url = FilesPath

Add new AcroForm field to a PDF

时光总嘲笑我的痴心妄想 提交于 2019-12-20 05:30:06
问题 I have used iText to fill data into existing AcroForm fields in a PDF. I am now looking for a solution to add new AcroForm fields to a PDF. Is this possible with iText? If so, how can I do this? 回答1: This is documented in the official documentation, more specifically in the SubmitForm example. When using a tool such as iText, you should read the official documentation first ;-) Anyway, I've written you a simple example called AddField. It adds a button field at a specific position defined by

iText - How to set stroke width and opacity for PdfAnnotationInk

空扰寡人 提交于 2019-12-20 05:19:24
问题 What functions should I call to set the stroke width and opacity when drawing ink type annotation? I have go through the class API for PdfAnnotation and PDFStamp, but it seems there are no functions to set the width and opacity directly. Any suggestions? Thanks. My sample program: final String sourceFile = "C:\\PdfAnnotation\\sample.pdf"; final String destFile = "C:\\PdfAnnotation\\output\\output.pdf"; PdfReader reader = new PdfReader(sourceFile); PdfStamper stamper = new PdfStamper(reader,

How to reorder the pages of a PDF file?

醉酒当歌 提交于 2019-12-20 04:45:08
问题 I am generating Table of Contents at last,I want to move Table of Contents at Beginning. Suppose that I have 16 pages in my PDF and that the TOC starts from page 13 and ends on page 15. I want to move the TOC to the second page, so that the first page remains page 1 and the last page remains page 16. This code doesn't give me what I want: public void changePagesOrder() { try { PdfReader sourcePDFReader = new PdfReader(RESULT1); int n = sourcePDFReader.getNumberOfPages(); System.out.println(

How to Read and Mark(Highlight) a pdf file using C#

≯℡__Kan透↙ 提交于 2019-12-20 04:29:10
问题 I have a pdf file which i am Reading as string page by page.Now from page 4 onwards my pdf contains billing information.These Billing information are under section for Example :- say one is Local Billing information and other is STD billing information etc.Now as per my requirement if user wants to validate Local Billing information my code should read all the Local Billing data and validate it,in case any data(row) validation gets failed it should highlight that row of the PDF File. Here is

Adding LTV in signature makes pdf invalid using C#

*爱你&永不变心* 提交于 2019-12-20 04:24:42
问题 After Adding LTV to digital signature it shows document has changed. After taking ref from this que : After LTV Certification Signature, PDF shows "Document has been Changed" I made changes in my code, It works fine with all document but for this document : https://www.sendspace.com/file/3ulwn7 - It shows Invalid signature. we are also using document signing service from global sign for same. Below code for adding LTV : public void AddLtv(string src, string dest, IOcspClient ocsp, ICrlClient

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.