[iText-questions] unsubscribe
Kind regards, Paul Sachs. Telephone +44 (0)8447 705 535 CaseLines150 Mobile +44 (0)7785 300029 Fax +44 (0)8701 161 803 Email <mailto:paul.sa...@netmastersolutions.co.uk> paul.sa...@netmastersolutions.co.uk Web <http://www.netmastersolutions.co.uk> www.netmastersolutions.co.uk Address Netmaster Solutions Ltd Communications House 26 York Street London W1U 6PZ From: iText Mailing List [mailto:i...@1t3xt.info] Sent: Saturday, May 11, 2013 10:55 AM To: Post all your questions about iText here Subject: Re: [iText-questions] How to save 'UTF-8' characters to PDF file in JAVA On Sat, 11 May 2013 11:44:53 +0200, Aleksander Sadecki wrote: I did it as you mentioned Wow, I've never met somebody that could read that fast! Are you sure you've read all the documentation in less than half an hour? Did you see http://manning.com/lowagie2/samplechapter2.pdf and read about all possible encoding problems, for instance as described on p26? Also you say "I did as you mentioned" without telling what you tried. I can't smell which encoding you used? Are you using the font as a simple font? Or are you using IDENTITY_H as encoding because you want a composite font (using Unicode)? You make it very difficult for somebody to help you. <>-- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
[iText-questions] Adding an internal anchor reference using ShowTextAligned causes a null reference exception
Hi, can anyone help with this? I am adding an anchor to a canvas. The canvas is the 'over content' for a single page in a PDFStamper object. The anchor is an internal reference to a name on another page. When I use ColumnText.ShowTextAligned to add the anchor I am getting a 'Object reference not set to an instance of an object' error. Is it because the canvas does not contain the target reference? If so, what can I do? Here is a working example of the problem: using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; var ms = new MemoryStream(); var document = new iTextSharp.text.Document(); // Create a simple two page PDF document: var pdfWriter = PdfWriter.GetInstance(document, ms); pdfWriter.InitialLeading = 40F; document.Open(); document.Add(new Phrase("Simple Phrase on Page 1")); document.NewPage(); document.Add(new Phrase("Simple Phrase on Page 2")); document.Close(); // Read the 2 page document, create a stamper and add two anchors // at absolute positions on page 1. var pdfReader = new PdfReader(ms.ToArray()); var ms2 = new MemoryStream(); var pdfStamper = new PdfStamper(pdfReader, ms2); var canvas = pdfStamper.GetOverContent(1); // add an external anchor var anchor1 = new Anchor("External Anchor"); anchor1.Reference = "www.stackoverflow.com"; ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, anchor1, 100, 200, 0); // add an internal anchor var anchor2 = new Anchor("Internal Anchor"); anchor2.Reference = "#abc"; // this next line causes a null reference exception - why? ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, anchor2, 100, 100, 0); pdfStamper.Close(); Thanks, Paul. -- Own the Future-IntelĀ® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
[iText-questions] Partial Printing of Direct Content
Hi, --- In C# --- I have a "PdfWriter writer". I use "DirectContent dc = writer.DirectContent;" I have a reader: "PdfReader reader = new PdfReader(pdfByteArray);" I take a page from the reader: "PdfImportedPage page = writer.GetImportedPage(reader, 1);" I add it to the "writer" using the direct content: "cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0);" Then I write some text over the imported page: dc.BeginText(); dc.SetLineWidth(2.5F); dc.SetColorFill(BaseColor.RED); dc.SetColorStroke(BaseColor.WHITE); dc.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 16); dc.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); dc.ShowTextAligned(Element.ALIGN_CENTER, "123", 50, 50, 0); dc.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL); dc.ShowTextAligned(Element.ALIGN_CENTER, "123", 50, 50, 0); dc.EndText(); This all works great and prints the number in red with a white shadow at the bottom of the page. - BUT - One of my clients has reported that the overwritten numbers do not always print on their printer. Sometimes some of the overwritten numbers are missing, even though they are visible in a PDF reader on the screen. I suspect this is a memory resources issue on the printer, which is making a decision to print at least one "layer" if it cannot print them all. But I'm guessing. Any thoughts anyone? Can I force all the direct content to "amalgamate" somehow into one item that either prints completely or doesn't print at all? Thanks to all - Paul. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
[iText-questions] Getting the document size before closing the document when using DirectContent.AddTemplate (C#)
Hi, I am adding between 1000 and 5000 pages to a PdfWriter. Each page is added by using writer.DirectContent.AddTemplate(writer.GetImportedPage(reader, pageNumber), a, b, c, d, e, f) I am using AddTemplate because I may need to rotate a page by 180 depending on a test. I would like to know when the size of the document that will be written has exceeded a threshold (e.g. 2 Mb). Then I can close the document and start a new one. I have tried writer.CurrentDocumentSize and writer.DirectContent.InternalBuffer.Size. Both report very small numbers. How can I find the size of the document written so far without doing a document.Close() ? -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php