itextsharp

iTextSharp: Flattening a field in table cell shifts text upward

醉酒当歌 提交于 2019-12-11 09:31:19
问题 I'm having an issue with flattening fields that were generated in a table cell. I've created a sample project to illustrate the issue. private static void dummyFunction2() { // Create a PDF with a TextBox in a table cell //Get the font ready BaseFont bfHelvetica = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1250, false); var helvetica12 = new Font(bfHelvetica, 12, Font.NORMAL, BaseColor.BLACK); //Create the document and filestream var doc = new Document(PageSize.LETTER, 18f, 18f, 18f,

Alter Links to Other PDF Documents

时光毁灭记忆、已成空白 提交于 2019-12-11 08:59:35
问题 We have a ton of pdf documents that each have links that open other pdf documents. When clicking on the links it will open up the other pdf document in the same file system. The problem is that we need to change the name of some of the directories which will require the changing of all the links that point to pdf documents in that directory. We would do this manually but there are literally thousands of links that need to be alter. We have tried to use iTextSharp and PdfSharp to alter the

ITextSharp image issue in PDF after printing

北战南征 提交于 2019-12-11 08:37:02
问题 I use ITextSharp to print a PDF document. I put a logo (logo of Microsoft as example) on document and it is described perfectly in PDF file. But after printing this PDF, I get gray dots accross logo on paper. I use a PNG image with transparent background, and my logo is in high resolution as Microsoft logo. Please help how I can solve this issue? 来源: https://stackoverflow.com/questions/23077256/itextsharp-image-issue-in-pdf-after-printing

How can I create document from byte[] in iTextSharp

折月煮酒 提交于 2019-12-11 08:06:24
问题 I'm looking for way to load an iTextSharp document from byte[] representing a PDF. 回答1: If b is a byte[] that represents a valid PDF file, then you can load the PDF into iTextSharp like this: PdfReader reader = new PdfReader(b); Now you can do all sorts of things with the reader object, such as copy pages using the PdfCopy class, stamp content on the PDF using PdfStamper , and so on. Read Chapter 6 of my book to find out what you can (or can't) do with the PdfReader object. You'll need the

iTextSharp multiple actions for pushbuttonfield

做~自己de王妃 提交于 2019-12-11 08:04:56
问题 In a PDF, I can set up a button to Submit the FDF data to my RestAPI Redirect to a webpage (to tell user 'Thanks') and that works perfectly. But I need to do this using code... I am using iTextSharp in the following way: pb is my pushbutton... sURL is the URL I need the data to go to... This is my code: PdfFormField pff = pb.Field; pff.SetAdditionalActions(PdfName.A, PdfAction.CreateSubmitForm(sURL, null, PdfAction.SUBMIT_XFDF)); af.ReplacePushbuttonField("submit", pff); This does replace the

How to rotate PDF page with iTextSharp without causing error in ghostscript?

偶尔善良 提交于 2019-12-11 08:01:12
问题 I'm trying to use iTextSharp to rotate a page & have it read by ghostscript to generate the pages as images. This is how I'm rotating the pages: byte[] retVal = null; using (MemoryStream oOutput = new MemoryStream()) { PdfReader oPDFReader = new PdfReader(BaseFile); PdfStamper stamper = new PdfStamper(oPDFReader, oOutput ); for (var pageNum = 1; pageNum <= oPDFReader.NumberOfPages; pageNum++) { var oDocumentPage = DocumentPages.Where(page => page.PageNumber == pageNum && page.RotationDegree !

Rebuild failed using PDF compression

末鹿安然 提交于 2019-12-11 07:49:00
问题 Im trying to use the methods described bt kuujinbo here. PDF Compression with iTextSharp This is my code, and it results in this error: "Rebuild failed: trailer not found.; Original message: PDF startxref not found." PdfReader reader = new PdfReader(output.ToArray()); ReduceResolution(reader, 9); // Save altered PDF. then you can pass the btye array to a database, etc using (MemoryStream ms = new MemoryStream()) { using (PdfStamper stamper = new PdfStamper(reader, ms)) { } document.Close();

Propagate the orientation setup at iTextSharp.text.Document creation to the Print dialog

依然范特西╮ 提交于 2019-12-11 07:35:03
问题 I use iTextSharp to create a PDF document in Landscape orientation by employing PageSize.A4.Rotate() to set its PageSize. The document is fed into a Stream and later saved into the database as a byte array (in a VARBINARY field). Stream stream = new MemoryStream(); iTextSharp document = new Document(); document.SetPageSize(PageSize.A4.Rotate()); var writer = PdfWriter.GetInstance(document, stream) document.Open() // Write to the document document.Close(); byte[] file = stream.ToArray(); /* In

Itextsharp special characters like <

杀马特。学长 韩版系。学妹 提交于 2019-12-11 07:32:41
问题 I am generating pdf using itextsharp i have one requirement to display << and >> in the pdf page how can i do this 回答1: If you know the entity number of the special character you can create that special character simply by using the following code. document.Add(Phrase.GetInstance(" This is " + (char)945)); Substitute your entity number instead of 945. Hope this helps. Edit: FontSelector class in iTextSharp will help you further if you have the required font with the symbols. 来源: https:/

No change in font face in html to pdf generation using iTextSharp

我的梦境 提交于 2019-12-11 06:58:54
问题 I'm using a HTML Rich-Text Editor to help me create a template for dynamic PDF reports, and it's working fine except that it doesn't change the font-face. This editor is using the font tag instead of CSS styles, and I would welcome any way to programmatically change the font tags to equivalent tags using styles instead. HTML (yes its messy, its from a WYSIWYG editor): <div>  <br> <div align="center"> <font size="5"> <b> <br> <div align="center"> <font font-face="Times New Roman" size="5"> <b