Re: [iText-questions] Bug for image in iTextSharp 4.1.6.0
Have you tried with iText 5.1.x maybe your problem has already been fixed. Kind regards Balder - Reply message - From: "David Thielen" Date: Thu, Jun 23, 2011 00:30 Subject: [iText-questions] Bug for image in iTextSharp 4.1.6.0 To: "itext-questions@lists.sourceforge.net" -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
On 22/06/2011 11:53, hhn000 wrote: > iTextSharp is developed by 1T3XT or iText Software Corp? All iText development is the responsibility of 1T3XT (EU). All iText sales are done through iText Software Corp (US). > The documentation for C# developers is: > - the book iText in Action > - the javadoc > - the examples converted to C# Yes. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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
Re: [iText-questions] iText 5.0.6
On 22/06/2011 15:17, Bipin Mallik wrote: > Hi, > We are inprocess of migrating the application from older version of > iText (iText 1.5) to the newer version of iText (iText 5.0.6). We are > using the below code for header and footer settings. As the RTF is > removed, could you please help us to use the ultare logic or function > to get the same functionality as below. Your help will help us for > successfull migration. You want to add a header and/or footer in an automated way? That can be done in two different ways: - either use PageEvents: http://1t3xt.be/?143 - or add the header in a second pass: http://1t3xt.be/?0f3 -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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
Re: [iText-questions] ArrayIndexOutOfBoundsException while encrypting a PDF with AES 256 (IText pdf java)
Certificate encryption for AES 256 is not yet supported. It should be available in September. Paulo -Original Message- From: Alex Miller [mailto:reisnakea...@gmail.com] Sent: Wednesday, June 22, 2011 2:48 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] ArrayIndexOutOfBoundsException while encrypting a PDF with AES 256 (IText pdf java) Hi, When I try to encrypt a pdf using AES 256 it gives me the following error: java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at com.itextpdf.text.pdf.PdfEncryption.setupByEncryptionKey(PdfEncryption.java:527) at com.itextpdf.text.pdf.PdfEncryption.getEncryptionDictionary(PdfEncryption.java:633) at com.itextpdf.text.pdf.PdfWriter.setEncryption(PdfWriter.java:2057) at com.itextpdf.text.pdf.PdfStamper.setEncryption(PdfStamper.java:349) This is the code that generates the error: public static KeyPair generateKeyPair(String algorithm, int bitLength) throws NoSuchAlgorithmException { KeyPairGenerator kpGen = null; try { kpGen = KeyPairGenerator.getInstance(algorithm, "BC"); } catch (NoSuchProviderException ex) { Logger.getLogger(Util.class.getName()).log(Level.SEVERE, null, ex); } kpGen.initialize(bitLength, new SecureRandom()); return kpGen.generateKeyPair(); } public static Certificate getCertificate(KeyPair pair) throws Exception { X509v3CertificateBuilder builder = new X509v3CertificateBuilder(new X500Name("CN=CA"), BigInteger.valueOf(new Date().getTime()), new Date(), new Date(new Date().getTime() + 1L), new X500Name("CN=Reader"), SubjectPublicKeyInfo.getInstance(pair.getPublic().getEncoded())); ContentSigner signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(pair.getPrivate()); X509CertificateHolder certHolder = builder.build(signer); ByteArrayInputStream bIn = new ByteArrayInputStream(certHolder.getEncoded()); return CertificateFactory.getInstance("X.509", "BC").generateCertificate(bIn); } public static void encryptPdf(String src, String dest, Certificate readCertificate) throws IOException, DocumentException, CertificateException { PdfReader reader = new PdfReader(src); FileOutputStream fout = new FileOutputStream(dest); PdfStamper stamper = new PdfStamper(reader, fout); stamper.setEncryption(new Certificate[]{readCertificate}, // This is the instruction that gives me the error! new int[]{PdfWriter.ALLOW_PRINTING}, // PdfWriter.ENCRYPTION_AES_256); // stamper.close(); fout.close(); } public static final String ORIGINAL = "./X509.pdf"; public static final String ENCIPHERED = "./X509-crypt.pdf"; public static final String DECIPHERED = "./X509-decrypt.pdf"; public static final String SIGNED = "./X509-signed.pdf"; public static void main(String[] args) { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); Certificate readerCert = null; System.out.println(Cipher.getMaxAllowedKeyLength("AES")); // OK KeyPair pair = generateKeyPair("RSA", 2048); readerCert = getCertificate(pair); System.out.println(readerCert); KeyPair fakePair = generateKeyPair("RSA", 2048); Certificate fakeCertificate = getCertificate(fakePair); encryptPdf(ORIGINAL, ENCIPHERED, readerCert); } My configuration: OS: Windows 7 x64 service pack 1 Jdk and Jre latest version 1.6.26 Itext latest version 5.11 IDE: netbeans 7.0 I've given a look at what happened inside Itext and i found that the instruction that launch exception is: "System.arraycopy(key, 0, mkey, 0, mkey.length);" where key is a 20 bytes arrays and mkey.length is 32! With the other algorithm (ARC4_40, ARC4_128, AES_128) i have no problem! I attach the pdf that i want to encipher. I thank you in advance Alex Miller. Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it bac
Re: [iText-questions] Odd behavior when changing margins between pages
Use ColumnText, doc.add() won't do for precise layout. Paulo From: Carlos Miguel [mailto:cmi...@hotmail.com] Sent: Wednesday, June 22, 2011 2:45 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] Odd behavior when changing margins between pages Hi, I'm trying to generate a document from a single long text paragraph that needs to have different margins for odd and even pages (not necessarily in a mirrored fashion) Since I have no control of what page will the text render in, the obvious route was to code a page event to change margins at the end of every page and let iTextPDF handle the text flow. So far I've almost succeeded, but I'm getting and odd behavior from the generated pdf: The first line of every page after changing margins, preserve the same margins as the previous page. I'm attaching both the test text and the resulting PDF. I'll appreciate your help. Regards. This is the code I'm using that triggers the behavior: public class TestClass { public static void main(String[] args) throws DocumentException, IOException{ Document doc = new Document(PageSize.LEGAL, 92f, 43f, 113f, 57f); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream("/tmp/test.pdf")); TestPageEvent event = new TestPageEvent(); event.setCurrentSide(1); writer.setPageEvent(event); Paragraph para = new Paragraph(readFileAsString("/tmp/loremipsum.txt")); para.setLeading(25); para.setAlignment(Element.ALIGN_JUSTIFIED); doc.open(); doc.add(para); doc.close(); } } This is the page event: public class TestPageEvent extends PdfPageEventHelper { private int CurrentSide; public void setCurrentSide(int currentSide) { CurrentSide = currentSide; } public void toggleSide() { CurrentSide = (CurrentSide == 1)? 2 : 1; } public void onEndPage(PdfWriter writer, Document doc) { toggleSide(); if (CurrentSide == 1) { doc.setMargins(92f, 43f, 113f, 57f); } else if (CurrentSide == 2) { doc.setMargins(43f, 92f, 57f, 99f); } } } Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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] Odd behavior when changing margins between pages
Hi, I'm trying to generate a document from a single long text paragraph that needs to have different margins for odd and even pages (not necessarily in a mirrored fashion)Since I have no control of what page will the text render in, the obvious route was to code a page event to change margins at the end of every page and let iTextPDF handle the text flow. So far I've almost succeeded, but I'm getting and odd behavior from the generated pdf: The first line of every page after changing margins, preserve the same margins as the previous page. I'm attaching both the test text and the resulting PDF. I'll appreciate your help. Regards. This is the code I'm using that triggers the behavior: public class TestClass { public static void main(String[] args) throws DocumentException, IOException{ Document doc = new Document(PageSize.LEGAL, 92f, 43f, 113f, 57f); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream("/tmp/test.pdf")); TestPageEvent event = new TestPageEvent(); event.setCurrentSide(1); writer.setPageEvent(event); Paragraph para = new Paragraph(readFileAsString("/tmp/loremipsum.txt")); para.setLeading(25);para.setAlignment(Element.ALIGN_JUSTIFIED); doc.open(); doc.add(para); doc.close();} } This is the page event: public class TestPageEvent extends PdfPageEventHelper { private int CurrentSide;public void setCurrentSide(int currentSide) { CurrentSide = currentSide; } public void toggleSide() { CurrentSide = (CurrentSide == 1)? 2 : 1;} public void onEndPage(PdfWriter writer, Document doc) { toggleSide(); if (CurrentSide == 1) { doc.setMargins(92f, 43f, 113f, 57f);} else if (CurrentSide == 2) {doc.setMargins(43f, 92f, 57f, 99f); } }}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris lacinia vehicula erat sit amet bibendum. In nibh dolor, gravida vel posuere at, pretium a diam. Nam rutrum sapien eget nibh feugiat sit amet laoreet tortor vehicula. Aenean in mattis nisi. Vivamus in lorem tellus. Phasellus vitae nunc lacus. Donec semper massa quis leo pellentesque dapibus tincidunt justo posuere. Sed arcu eros, consequat ut fringilla ut, venenatis quis massa. Quisque eget libero dolor, ut aliquam risus. Nulla bibendum, orci ac dapibus consequat, est ante pellentesque turpis, et molestie quam ligula sit amet quam. Vestibulum varius tristique elit nec condimentum. Praesent fringilla neque vitae enim venenatis vel rhoncus purus imperdiet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec varius posuere orci, pulvinar tempor lacus blandit ac. Quisque fermentum, arcu id euismod fringilla, nibh orci consequat lectus, vel venenatis dolor velit ac metus. Nunc vitae turpis at urna hendrerit pellentesque vitae sed nisl. Praesent et velit ut tellus pulvinar mattis. Vivamus vitae nisi id odio adipiscing volutpat in vitae turpis. Sed facilisis imperdiet ante, vel condimentum neque feugiat eu. Praesent volutpat ultricies odio, in molestie est convallis non. Ut lobortis eleifend tincidunt. Curabitur tincidunt, sapien non dictum porta, mi augue pharetra nibh, et posuere dolor lectus ut tellus. Aenean feugiat nisi non eros convallis posuere. Suspendisse sed elit urna. Proin tristique, enim eu faucibus convallis, ligula lectus dignissim leo, a placerat nibh dui eu massa. Etiam vitae nisl justo. Duis sagittis egestas commodo. Sed et dignissim ante. Ut molestie iaculis gravida. Etiam massa libero, gravida eu interdum tincidunt, lacinia ac purus. Mauris sit amet hendrerit diam. Pellentesque ante leo, consectetur hendrerit tincidunt posuere, gravida sed ipsum. Praesent pharetra justo et orci ultrices porttitor. Morbi et augue dolor, at cursus metus. Nulla et nulla quis turpis lacinia cursus id vitae sem. Nam in ultricies tortor. Aenean sit amet tellus nisi. Nulla iaculis facilisis risus nec volutpat. Nam nec eros eu orci viverra molestie. Duis eget tellus tellus. Nunc massa sem, rhoncus at molestie sit amet, posuere vitae lorem. Proin tortor est, hendrerit nec commodo at, fermentum non diam. Nunc sit amet nulla libero. Nam enim nisl, dignissim et blandit ut, malesuada vel metus. Praesent consectetur viverra dui, sit amet venenatis ipsum pharetra in. Etiam orci felis, convallis ac ultrices sed, volutpat in erat. Fusce vitae nibh odio, et tincidunt ipsum. Morbi sagittis lacinia eros, ut accumsan lorem viverra bibendum. Cras lacus turpis, cursus vel congue id, dapibus ac turpis. Ut nec malesuada urna. Sed eros est, laoreet a mattis a, porta ac dui. Ut dolor dui, sodales quis commodo ac, commodo a turpis. Fusce venenatis, lorem vitae elementum mole
Re: [iText-questions] C# embedded fonts
Ok, My story is straight, but my facts were off somewhat, sorry about that. But I didn't claim that it was your site. Are these facts correct? (I don't want to troll or insult anyone, but would like to clear up the facts) iTextSharp is developed by 1T3XT or iText Software Corp? The documentation for C# developers is: - the book iText in Action - the javadoc - the examples converted to C# Is there any other official resources that I've missed? On Wed, Jun 22, 2011 at 11:26, 1T3XT BVBA wrote: > ** > You are assuming that itextsharp.com is owned by 1T3XT or iText Software > Corp. > It isn't. itextsharp.com was registered by somebody we'll probably have to > sue someday. > The official iText page is http://itextpdf.com/ > Again, you are complaining against the REAL iText people referring to > UNOFFICIAL information. > Please get your story straight!!! > > -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] Regarding automatic trim of whitespaces
On 22/06/2011 11:31, sumeet gupta wrote: > I was trying to write some strings with extra speces in its rights > side in to a table , But generated pdf does not contains the white > spaces . Try "hello\u00a0\u00a0\u00a0\u00a0" and return to us if that doesn't work. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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] Regarding automatic trim of whitespaces
Hi members, I was trying to write some strings with extra speces in its rights side in to a table , But generated pdf does not contains the white spaces . I have tried this : Chunk chunk= new Chunk("hello"); Phrase phrase = new Phrase(chunk); PdfPCell cell= new PdfPCell(phrase); cell.setBorderColor(new BaseColor(Color.black)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); PdfPTable table= new PdfPTable(1); table.addCell(cell); In output there is no whitespace. -- Sumeet -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
On 22/06/2011 11:24, hhn000 wrote: > Not in this specific case, Paragraph.alignment. From Element.cs: > > public const int ALIGN_UNDEFINED = -1; > public const int ALIGN_LEFT = 0; > public const int ALIGN_CENTER = 1; > public const int ALIGN_RIGHT = 2; You aren't supposed to use the values -1, 0, 1, or 2. You are supposed to use the values ALIGN_UNDEFINED, ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT,... These constants are listed in the iText API docs and are valid. What is your point? -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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
Re: [iText-questions] C# embedded fonts
On 22/06/2011 11:20, hhn000 wrote: From http://itextsharp.com/ Tutorials for Learning iTextSharp Although the official documentation contains tutorials for Java developers only, .NET developers should find iText in Action a useful introduction to iTextSharp. Am I insulting the author of a book, by asking a question about something, that's plainly stated on the front page of the project? You are assuming that itextsharp.com is owned by 1T3XT or iText Software Corp. It isn't. itextsharp.com was registered by somebody we'll probably have to sue someday. The official iText page is http://itextpdf.com/ Again, you are complaining against the REAL iText people referring to UNOFFICIAL information. Please get your story straight!!! -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
Not in this specific case, Paragraph.alignment. From Element.cs: public const int ALIGN_UNDEFINED = -1; public const int ALIGN_LEFT = 0; public const int ALIGN_CENTER = 1; public const int ALIGN_RIGHT = 2; On Wed, Jun 22, 2011 at 11:09, 1T3XT BVBA wrote: > On 22/06/2011 11:03, hhn000 wrote: > > like a list of the valid values, constants in this case > That's impossible, isn't it? > The constants depend on the fonts in the directories you register. > Typically, the list of valid values will be much shorter on American > versions of Windows than on European versions. > If you register a font directory on Linux, you will get totally > different fonts (Nimbus instead of Times, etc...). > > As for the acronym: HAND means Have A Nice Day. > > > -- > Simplify data backup and recovery for your virtual environment with > vRanger. > Installation's a snap, and flexible recovery options mean your data is > safe, > secure and there when you need it. Data protection magic? > Nope - It's vRanger. Get your free trial download today. > http://p.sf.net/sfu/quest-sfdev2dev > ___ > 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 > -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
By "the official documentation" you mean the iText book, right? and you also think that it is documentation about the C# version, iTextSharp? I'm saying that the actual C# documentation, written about C# is very hard to find if it exists outside the book about the Java version. If you have any links, please share. >From http://itextsharp.com/ Tutorials for Learning iTextSharp Although the official documentation contains tutorials for Java developers only, .NET developers should find iText in Action a useful introduction to iTextSharp. Am I insulting the author of a book, by asking a question about something, that's plainly stated on the front page of the project? Either I didn't insult him (which certainly wasn't my intention) or he should have a word with the administrators of that page first. On Wed, Jun 22, 2011 at 11:02, 1T3XT BVBA wrote: > On 22/06/2011 10:46, hhn000 wrote: > > I did read the full article > 1. That article isn't part of the official documentation. It's a blog > written by a user. Please refer to the official documentation before you > say things such as "Are there plans to document the iTextSharp project?" > > Or are you saying the official documentation says something else? > (If you don't own a copy of the book, please don't insult its author by > saying his documentation isn't clear!) > > > -- > Simplify data backup and recovery for your virtual environment with > vRanger. > Installation's a snap, and flexible recovery options mean your data is > safe, > secure and there when you need it. Data protection magic? > Nope - It's vRanger. Get your free trial download today. > http://p.sf.net/sfu/quest-sfdev2dev > ___ > 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 > -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
On 22/06/2011 11:03, hhn000 wrote: > like a list of the valid values, constants in this case That's impossible, isn't it? The constants depend on the fonts in the directories you register. Typically, the list of valid values will be much shorter on American versions of Windows than on European versions. If you register a font directory on Linux, you will get totally different fonts (Nimbus instead of Times, etc...). As for the acronym: HAND means Have A Nice Day. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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
Re: [iText-questions] C# embedded fonts
No, I didn't reverse engineer the entire library, and having the source doesn't exactly eliminate the need to extract information about the library (what is normally in the documentation) the hard way, just makes it easier. Proper documentation = the book? As I've said delivery is not instant. On Wed, Jun 22, 2011 at 10:56, Paulo Soares wrote: > ** > Font registration has always been the same in Java and C#. As for > documentation, two book were written about iText and although they are for > Java 99% also applies to C# and most of the example were ported in > http://kuujinbo.info/iTextInAction2Ed/index.aspx. If you have to reverse > engineer the library (an interesting concept, considering the you have the > sources) you didn't care look for the proper documentation. > > Paulo > > - Original Message - > *From:* hhn000 > *To:* itext-questions@lists.sourceforge.net > *Sent:* Wednesday, June 22, 2011 9:26 AM > *Subject:* Re: [iText-questions] C# embedded fonts > > It seems that somewhere between 2008 when Mike wrote his articles and now, > that the default font directories aren't automatically registered :-( Are > there plans to document the iTextSharp project? It seems counterproductive > that every developer has to reverse engineer the library. > > On Wed, Jun 22, 2011 at 09:08, hhn000 wrote: > >> Hi, >> >> from what I can see in >> http://www.mikesdotnetting.com/Article/81/iTextSharp-Working-with-Fontsthe >> following line should embed a named font (and create a Font object >> suitable for use in a Paragraph) >> >> Font = FontFactory.GetFont(name, BaseFont.CP1252, BaseFont.EMBEDDED, >> size); >> >> except that the resulting pdf doesn't seem to contain any font objects >> besides a standard helvetica >> >> 1 0 obj >> <> >> endobj >> >> exactly the same I get when using >> >> Font = FontFactory.GetFont(name, size); >> >> Am I missing some setup? This is basically my initialization: >> >> public static string[] FontFamily = { "Arial", "Courier", "Arial >> Bold", "Arial Bold", "Arial Black", "Arial Bold", "Arial Bold", "Arial" }; >> >> _fonts = new List(); >> var length = Math.Min(FontFamily.Length, FontSize.Length); >> for (var i = 0; i < length; i++) >> _fonts.Add(new PdfFont(FontFamily[i], FontSize[i])); >> _document = new Document(PageSize.A4); >> _stream = new MemoryStream(); >> _writer = PdfWriter.GetInstance(_document, _stream); >> _document.Open(); >> >> --No1 >> > > > > -- > Simplify data backup and recovery for your virtual environment with > vRanger. > Installation's a snap, and flexible recovery options mean your data is > safe, > secure and there when you need it. Data protection magic? > Nope - It's vRanger. Get your free trial download today. > http://p.sf.net/sfu/quest-sfdev2dev > ___ > 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 > -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
> > On 22/06/2011 10:26, hhn000 wrote: > > Are there plans to document the iTextSharp project? > There's a 386 page book about iText! > OK, that's about the Java version, but most of the examples were ported to > C#. > Are you saying there's a lack of documentation? If so, are you a troll? > HAND > Yes, it IS about Java. I didn't ask about the Java version, I am aware of the book, but until Amazon can deliver dead trees instantly, it still takes time to get it in my hands, right? And that still doesn't answer the question about the C# version. Not sure if I got the wrong version off SF, but I don't have ANY description of the methods in intellisense, not even what the return value of FontFactory.RegistrerDirectories() is... I do think that could be improved (unless I messed up). The javadoc, (i.e. http://api.itextpdf.com/itext/com/itextpdf/text/Paragraph.html#alignment) could include a bit more information (like a list of the valid values, constants in this case, so I wouldn't have to consult the source code), this might be a limitation of the system. NO! I'm not saying that there is no documentation of iText. YES! I am saying that there is little, or outdated documentation of iTextSharp! I haven't read the book, so I don't know the extent of the differences between the book and the implementation of iTextSharp, but if there are differences I can hardly be called documentation of the C# version. No I'm not a troll, I do believe that I'm correct about the amount of documentation, and you haven't provided any evidence to disprove it.Isn't calling anyone with another opinion than your own a troll, itself the actions of a troll? If so, are you a troll? I'm sorry but I don't understand the acronym. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
On 22/06/2011 10:46, hhn000 wrote: > I did read the full article 1. That article isn't part of the official documentation. It's a blog written by a user. Please refer to the official documentation before you say things such as "Are there plans to document the iTextSharp project?" 2. If you register a font directory (any font directory), iTextSharp will register as many fonts as possible. Some fonts will be overlooked (for instance .FON files). You can check which fonts were registered by looping over FontFactory.RegisteredFonts. I don't understand your problem: - you register a directory that contains arial.ttf, arialb.ttf, ariali.ttf and arialbd.ttf. - when you loop over the registered fonts, you see names such as: "arial", "arial bold", "arial black",... - if the above is valid, then you are able to use Arial (instead of Helvetica). Are you saying this doesn't work? Or are you saying the official documentation says something else? (If you don't own a copy of the book, please don't insult its author by saying his documentation isn't clear!) -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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
Re: [iText-questions] C# embedded fonts
Font registration has always been the same in Java and C#. As for documentation, two book were written about iText and although they are for Java 99% also applies to C# and most of the example were ported in http://kuujinbo.info/iTextInAction2Ed/index.aspx. If you have to reverse engineer the library (an interesting concept, considering the you have the sources) you didn't care look for the proper documentation. Paulo - Original Message - From: hhn000 To: itext-questions@lists.sourceforge.net Sent: Wednesday, June 22, 2011 9:26 AM Subject: Re: [iText-questions] C# embedded fonts It seems that somewhere between 2008 when Mike wrote his articles and now, that the default font directories aren't automatically registered :-( Are there plans to document the iTextSharp project? It seems counterproductive that every developer has to reverse engineer the library. On Wed, Jun 22, 2011 at 09:08, hhn000 wrote: Hi, from what I can see in http://www.mikesdotnetting.com/Article/81/iTextSharp-Working-with-Fonts the following line should embed a named font (and create a Font object suitable for use in a Paragraph) Font = FontFactory.GetFont(name, BaseFont.CP1252, BaseFont.EMBEDDED, size); except that the resulting pdf doesn't seem to contain any font objects besides a standard helvetica 1 0 obj <> endobj exactly the same I get when using Font = FontFactory.GetFont(name, size); Am I missing some setup? This is basically my initialization: public static string[] FontFamily = { "Arial", "Courier", "Arial Bold", "Arial Bold", "Arial Black", "Arial Bold", "Arial Bold", "Arial" }; _fonts = new List(); var length = Math.Min(FontFamily.Length, FontSize.Length); for (var i = 0; i < length; i++) _fonts.Add(new PdfFont(FontFamily[i], FontSize[i])); _document = new Document(PageSize.A4); _stream = new MemoryStream(); _writer = PdfWriter.GetInstance(_document, _stream); _document.Open(); --No1 -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
> > On 22/06/2011 9:08, hhn000 wrote: > > Hi, > > > > from what I can see in > > http://www.mikesdotnetting.com/Article/81/iTextSharp-Working-with-Fontsthe > > following line should embed a named font (and create a Font object > > suitable for use in a Paragraph) > > > > Font = FontFactory.GetFont(name, BaseFont.CP1252, BaseFont.EMBEDDED, > > size); > > > > except that the resulting pdf doesn't seem to contain any font objects > > besides a standard helvetica > > > > 1 0 obj > > <> > > endobj > > > > exactly the same I get when using > > > > Font = FontFactory.GetFont(name, size); > > > > Am I missing some setup? > > You didn't read the full article. You missed the part about "registering > fonts". > > int totalfonts = FontFactory.RegisterDirectory("C:\\WINDOWS\\Fonts"); > > You can only use font names that are RegisteredFonts in the FontFactory: > > StringBuilder sb = new StringBuilder(); > foreach (string fontname in FontFactory.RegisteredFonts) { > sb.Append(fontname + "\n"); > } > doc.Add(new Paragraph("All Fonts:\n" + sb.ToString())); > > > Please don't use iText without reading the official documentation: > http://itextpdf.com/book/ > I did read the full article including the passage: "!Each time that you call FontFactory.GetFont(), a new Font object is created. This method will work directly with all fonts registered by iTextSharp, which includes all fonts found in the Windows default font directory. On Win XP Pro, that's usually C:/WINDOWS/Fonts." which seem to imply that iTextSharp automatically registers "all fonts found in the Windows default font directory" (direct quote). -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
On 22/06/2011 10:26, hhn000 wrote: > Are there plans to document the iTextSharp project? There's a 386 page book about iText! OK, that's about the Java version, but most of the examples were ported to C#. Are you saying there's a lack of documentation? If so, are you a troll? HAND -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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
Re: [iText-questions] C# embedded fonts
It seems that somewhere between 2008 when Mike wrote his articles and now, that the default font directories aren't automatically registered :-( Are there plans to document the iTextSharp project? It seems counterproductive that every developer has to reverse engineer the library. On Wed, Jun 22, 2011 at 09:08, hhn000 wrote: > Hi, > > from what I can see in > http://www.mikesdotnetting.com/Article/81/iTextSharp-Working-with-Fontsthe > following line should embed a named font (and create a Font object > suitable for use in a Paragraph) > > Font = FontFactory.GetFont(name, BaseFont.CP1252, BaseFont.EMBEDDED, size); > > except that the resulting pdf doesn't seem to contain any font objects > besides a standard helvetica > > 1 0 obj > <> > endobj > > exactly the same I get when using > > Font = FontFactory.GetFont(name, size); > > Am I missing some setup? This is basically my initialization: > > public static string[] FontFamily = { "Arial", "Courier", "Arial > Bold", "Arial Bold", "Arial Black", "Arial Bold", "Arial Bold", "Arial" }; > > _fonts = new List(); > var length = Math.Min(FontFamily.Length, FontSize.Length); > for (var i = 0; i < length; i++) > _fonts.Add(new PdfFont(FontFamily[i], FontSize[i])); > _document = new Document(PageSize.A4); > _stream = new MemoryStream(); > _writer = PdfWriter.GetInstance(_document, _stream); > _document.Open(); > > --No1 > -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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] Rotate removes last page number in TOC
Hi, I'm having a strange problem with a pdf i'm creating. I have a document containing several pages, on the second page I create a Table of contents as described in the itext book. This works perfectly until i rotate the last page in my document, this is the last piece of code before the TOC is created: document.setPageSize( PageSize.LETTER.rotate() ); document.newPage(); paragraph = new Paragraph(); //code to create paragraph section.add( paragraph ); document.add( section ); document.setPageSize( PageSize.LETTER ); By adding this line: document.setPageSize( PageSize.LETTER.rotate() ); My TOC of contents is broken, the last page number isn't shown any more. The title is shown and the link works but the pag enumber is gone. If I remove this line everything is shown as it should. Screenshot with pagenumber:http://dl.getdropbox.com/u/1338176/TOC%20with%20pagenumber.png Screenshot without: http://dl.getdropbox.com/u/1338176/TOC%20without%20pagenumber.png How I create the TOC: private void createTOC() throws DocumentException { /* Table Of contents */ document.setPageSize( PageSize.LETTER ); document.newPage(); int toc = writer.getPageNumber(); Paragraph paragraph = new Paragraph( "Table of Contents" ); paragraph.setFont( FontFactory.getFont( "", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 13, Font.BOLD ) ); paragraph.setAlignment( Element.ALIGN_CENTER ); document.add( paragraph ); int count = event.titles.size(); for ( Paragraph p : event.titles ) { document.add( p ); } document.add ( new Paragraph() ); document.newPage(); int total = writer.reorderPages( null ); int[] order = new int[total]; order[0]=1; order[1]=toc; for ( int i = 2; i < total; i++ ) { order[i] = i; } writer.reorderPages( order ); } Can anyone help me with this problem? Thanks in advance Joris S. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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
Re: [iText-questions] C# embedded fonts
On 22/06/2011 9:08, hhn000 wrote: > Hi, > > from what I can see in > http://www.mikesdotnetting.com/Article/81/iTextSharp-Working-with-Fonts the > following line should embed a named font (and create a Font object > suitable for use in a Paragraph) > > Font = FontFactory.GetFont(name, BaseFont.CP1252, BaseFont.EMBEDDED, > size); > > except that the resulting pdf doesn't seem to contain any font objects > besides a standard helvetica > > 1 0 obj > <> > endobj > > exactly the same I get when using > > Font = FontFactory.GetFont(name, size); > > Am I missing some setup? You didn't read the full article. You missed the part about "registering fonts". int totalfonts = FontFactory.RegisterDirectory("C:\\WINDOWS\\Fonts"); You can only use font names that are RegisteredFonts in the FontFactory: StringBuilder sb = new StringBuilder(); foreach (string fontname in FontFactory.RegisteredFonts) { sb.Append(fontname + "\n"); } doc.Add(new Paragraph("All Fonts:\n" + sb.ToString())); Please don't use iText without reading the official documentation: http://itextpdf.com/book/ -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ 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] C# embedded fonts
Hi, from what I can see in http://www.mikesdotnetting.com/Article/81/iTextSharp-Working-with-Fonts the following line should embed a named font (and create a Font object suitable for use in a Paragraph) Font = FontFactory.GetFont(name, BaseFont.CP1252, BaseFont.EMBEDDED, size); except that the resulting pdf doesn't seem to contain any font objects besides a standard helvetica 1 0 obj <> endobj exactly the same I get when using Font = FontFactory.GetFont(name, size); Am I missing some setup? This is basically my initialization: public static string[] FontFamily = { "Arial", "Courier", "Arial Bold", "Arial Bold", "Arial Black", "Arial Bold", "Arial Bold", "Arial" }; _fonts = new List(); var length = Math.Min(FontFamily.Length, FontSize.Length); for (var i = 0; i < length; i++) _fonts.Add(new PdfFont(FontFamily[i], FontSize[i])); _document = new Document(PageSize.A4); _stream = new MemoryStream(); _writer = PdfWriter.GetInstance(_document, _stream); _document.Open(); --No1 -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev___ 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