Re: [iText-questions] Missing Japanese charecters in PDF
I suggest you ask jasper reports about it, we don't know how they are using iText. Paulo -Original Message- From: shivenderd [mailto:shivend...@gmail.com] Sent: Wednesday, August 04, 2010 1:41 AM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] Missing Japanese charecters in PDF Hi, I use jasper reports and it uses the iText to write to PDF. I have used the below given PDF font name and PDF encoding for japanese text: PDFFontName:HeiseiKakuGo-W5 PDFFontEncoding:UniJIS-UCS2-H I have the iTextAsian.jar is in classpath. I see almost all japanese characters in the PDF except few characters, the following couple of charecters are never displayed in the PDF but I see a blank space in the PDF. I am sure it is not a truncating issue, the characters were written but I think there is some problem with the encoding: 미술 Please let me know if you have any suggestions on this. Thanks, Shivender 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. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PdfStamper vs PdfReader page size
page.getPdfDocument() doesn't make sense in this context where you don't really have a PdfDocument to write to. Paulo From: Karol Bryd [mailto:karo...@gmail.com] Sent: Tuesday, August 03, 2010 9:49 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] PdfStamper vs PdfReader page size Hello Perhaps this is a silly question but I am still going to ask it :-) I have a following code fragment: public static void main( String[] args ) throws Exception { PdfReader reader = new PdfReader(/tmp/input.pdf); File tmpFile = File.createTempFile(tmp_stamper, .pdf); System.out.println(Reader page size + reader.getPageSize(1).getWidth() + x + reader.getPageSize(1).getHeight()); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(tmpFile)); System.out.println(Stamper Size + stamper.getWriter().getPageSize().getWidth() + x + stamper.getWriter().getPageSize().getHeight()); Image img = Image.getInstance(http://kombajn.ath.cx/test.jpg;); img.setAbsolutePosition(0, 0); for(int n = 1; n reader.getNumberOfPages(); n++) { PdfContentByte page = stamper.getUnderContent(n); //img.scaleAbsolute(stamper.getReader().getPageSize(n).getWidth(), stamper.getReader().getPageSize(n).getHeight()); // THIS WORKS FINE img.scaleAbsolute(page.getPdfDocument().getPageSize().getWidth(), page.getPdfDocument().getPageSize().getHeight()); // THIS DOESN'T page.addImage(img); } stamper.close(); reader.close(); } The input focument /tmp/input.pdf is a simple PDF document with pages which have 612x792 pixels (US Letter Portrait). Question is: why page size retrieved from PdfStamper differes from page size from the PdfReader? This code when run will output this: Reader page size 612.0x792.0 Stamper Size 595.0x842.0 and the img.scaleAbsolute will not work correctly when the page size is taken from the page.getPdfDocument().getPageSize() but it will work just fine when width and height is from the PdfReader? Why is that? Thanks Karol 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. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] IText Barcode Image Format
Thank you very much. That worked. The only differences i see is the size of the image generated (which can be adjust by the ScalePercent method, and the barcode value which now is printed under the barcode. Is there any chance to hide the barcode value using CMYK images ? Thank you very much -- View this message in context: http://itext-general.2136553.n4.nabble.com/IText-Barcode-Image-Format-tp2311940p2313185.html Sent from the iText - General mailing list archive at Nabble.com. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] IText Barcode Image Format
Set the font to null. Paulo -Original Message- From: Duncan_McCloud [mailto:duncanmcclou...@gmail.com] Sent: Wednesday, August 04, 2010 10:48 AM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] IText Barcode Image Format Thank you very much. That worked. The only differences i see is the size of the image generated (which can be adjust by the ScalePercent method, and the barcode value which now is printed under the barcode. Is there any chance to hide the barcode value using CMYK images ? Thank you very much 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. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] Scott Goette is out sick today
I will be out of the office starting Wed 08/04/2010 and will not return until Thu 08/05/2010. I'm out of the office today, but will reply to your message when I return. /pre This communication may contain privileged and/or confidential information. It is intended solely for the use of the addressee. If you are not the intended recipient, you are strictly prohibited from disclosing, copying, distributing or using any of this information. If you received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. This communication may contain nonpublic personal information about consumers subject to the restrictions of the Gramm-Leach-Bliley Act. You may not directly or indirectly reuse or redisclose such information for any purpose other than to provide the services for which you are receiving the information. 127 Public Square, Cleveland, OH 44114 pre If you prefer not to receive future e-mail offers for products or services from Key send an e-mail to mailto:dnereque...@key.com with 'No Promotional E-mails' in the SUBJECT line. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] updated template not working
We use a pdf template and acrofields in order to create tailored pdf's for each customer. I was tasked with modifying the pdf template to include a new dynamic field and some new hardcoded fields. I uploaded the new template pdf in eclipse to run in a java app. When I run the app the new template is being picked up but all of the dynamic data is being omitted except for one field. If I revert back to the old pdf template then it prints the template and all the dynamic output correctly(minus the new stuff). Any ideas why the new template isn't printing the dynamic fields? -- View this message in context: http://itext-general.2136553.n4.nabble.com/updated-template-not-working-tp2312647p2312647.html Sent from the iText - General mailing list archive at Nabble.com. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] Image scaling not possible in some cases
Somehow there was a formatting problem with my thread. Here is it again: Hi all, I'd like to put paragraphs in columns and add images in between so that they don't overlap but follow each other. As it turns out, I can do this but can't scale the image at the same time.To be more specific: When I add images Image img = Image.getInstance(imgFile); and when I am in composite mode, which means I work with ColumnText and add objects (paragraphs, images, ...) by ct.AddElement(p); ct.AddElement(img); ct.AddElement(p); my image gets blown up to the size set previously by ct.setSimplaColumn(left, bottom, right, top); and all attempts to scale the image like img.ScalePercent(100, 50); before adding it are just IGNORED. The Paragraph p followed by the image is placed after the image, not over the image, as want it. However, when I want to scale the image, I have to add it by ct.AddParagraph(new Chunk(img, 0, 0)); Then the image is not blown up as above and I am even able to scale the image (all these functions work), however the image is placed over the existing text and the next paragraph is likewise not placed below the image but over it. Hence the yLine is not updated after image insertion. So it seems that I can't have both worlds, what would mean: Being able to scale the image und at the same time place it between paragraphs without adjusting the yLine or by other absolute positioning means. Am I missing a point or are my observations correct ? I'd appreciate any comments. PS: I'm using iTextSharp but I don't think that this causes a the problem here. -- View this message in context: http://itext-general.2136553.n4.nabble.com/Image-scaling-not-possible-in-some-cases-tp2313229p2313231.html Sent from the iText - General mailing list archive at Nabble.com. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] about the Signature by PFX
Hi,It's said you can use the PFX to sign PDF document. Could you send the code to me? I need to sign some PDF document which a digital signature.but I can't in the C#. thank you so much! -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] Image scaling not possible in some cases
Hi all, I'd like to put paragraphs in columns and add images in between so that they don't overlap but follow each other. As it turns out, I can do this but can't scale the image at the same time.To be more specific: When I add images Image img = Image.getInstance(imgFile); and when I am in composite mode, which means I work with ColumnText and add objects (paragraphs, images, ...) by ct.AddElement(p); ct.AddElement(img); ct.AddElement(p); my image gets blown up to the size set previously by ct.setSimplaColumn(left, bottom, right, top); and all attempts to scale the image like img.ScalePercent(100, 50); before adding it are just IGNORED. The Paragraph p followed by the image is placed after the image, not over the image, as want it. However, when I want to scale the image, I have to add it by ct.AddParagraph(new Chunk(img, 0, 0)); Then the image is not blown up as above and I am even able to scale the image (all these functions work), however the image is placed over the existing text and the next paragraph is likewise not placed below the image but over it. Hence the yLine is not updated after image insertion. So it seems that I can't have both worlds, what would mean: Being able to scale the image und at the same time place it between paragraphs without adjusting the yLine or by other absolute positioning means. Am I missing a point or are my observations correct ? I'd appreciate any comments. PS: I'm using iTextSharp but I don't think that this causes a the problem here. -- View this message in context: http://itext-general.2136553.n4.nabble.com/Image-scaling-not-possible-in-some-cases-tp2313229p2313229.html Sent from the iText - General mailing list archive at Nabble.com. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] cutoff images
I am having trouble with the last image of a number in a document occasionally being chopped off. int BORDER_WIDTH = 10; Image img = Image.getInstance(dataFile); img.setAlignment(Image.ALIGN_CENTER); float pageWidth = img.getScaledWidth(); float pageHeight = img.getScaledHeight(); Rectangle r = new Rectangle(pageWidth + BORDER_WIDTH, pageHeight + BORDER_HEIGHT); document.setPageSize(r); document.add(img); This is done a number of times and inevitably one or more of the images - particularly the last one - are chopped off heightwise. Suggestions are appreciated. Thanks, Steve -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] Image scaling not possible in some cases
You need to have a leading based on the font size or image size, for example Paragraph.SetLeading(0, 1.25f). Paulo -Original Message- From: alrts [mailto:edition-b...@swissonline.ch] Sent: Wednesday, August 04, 2010 11:15 AM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Image scaling not possible in some cases Somehow there was a formatting problem with my thread. Here is it again: Hi all, I'd like to put paragraphs in columns and add images in between so that they don't overlap but follow each other. As it turns out, I can do this but can't scale the image at the same time.To be more specific: When I add images Image img = Image.getInstance(imgFile); and when I am in composite mode, which means I work with ColumnText and add objects (paragraphs, images, ...) by ct.AddElement(p); ct.AddElement(img); ct.AddElement(p); my image gets blown up to the size set previously by ct.setSimplaColumn(left, bottom, right, top); and all attempts to scale the image like img.ScalePercent(100, 50); before adding it are just IGNORED. The Paragraph p followed by the image is placed after the image, not over the image, as want it. However, when I want to scale the image, I have to add it by ct.AddParagraph(new Chunk(img, 0, 0)); Then the image is not blown up as above and I am even able to scale the image (all these functions work), however the image is placed over the existing text and the next paragraph is likewise not placed below the image but over it. Hence the yLine is not updated after image insertion. So it seems that I can't have both worlds, what would mean: Being able to scale the image und at the same time place it between paragraphs without adjusting the yLine or by other absolute positioning means. Am I missing a point or are my observations correct ? I'd appreciate any comments. PS: I'm using iTextSharp but I don't think that this causes a the problem here. 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. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] about the Signature by PFX
See http://itextpdf.sourceforge.net/howtosign.html#signtsocspcs. It does a lot more than you want but just remove the timestamp and ocsp. Other options are possible, look at the java examples, it's about the same in C#. Paulo -Original Message- From: xyester...@gmail.com [mailto:xyester...@gmail.com] Sent: Wednesday, August 04, 2010 1:07 PM To: iText-questions@lists.sourceforge.net Subject: [iText-questions] about the Signature by PFX Hi,It's said you can use the PFX to sign PDF document. Could you send the code to me? I need to sign some PDF document which a digital signature.but I can't in the C#. thank you so much! 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. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] Missing Japanese charecters in PDF
Thanks for the reply. I figured out that these are korean characters so japanese encoding did not work for me. Thanks, Shivender On Wed, Aug 4, 2010 at 1:27 AM, Paulo Soares psoa...@glintt.com wrote: I suggest you ask jasper reports about it, we don't know how they are using iText. Paulo -Original Message- From: shivenderd [mailto:shivend...@gmail.com] Sent: Wednesday, August 04, 2010 1:41 AM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] Missing Japanese charecters in PDF Hi, I use jasper reports and it uses the iText to write to PDF. I have used the below given PDF font name and PDF encoding for japanese text: PDFFontName:HeiseiKakuGo-W5 PDFFontEncoding:UniJIS-UCS2-H I have the iTextAsian.jar is in classpath. I see almost all japanese characters in the PDF except few characters, the following couple of charecters are never displayed in the PDF but I see a blank space in the PDF. I am sure it is not a truncating issue, the characters were written but I think there is some problem with the encoding: 미술 Please let me know if you have any suggestions on this. Thanks, Shivender 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. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] Null pointer exception in PdfWriter
Gents, I'm using an older version of iTextSharp (4.1.6 equivalent), and recently ran into a null pointer exception in PdfWriter while splitting a PDF file. Never seen this before despite running all kinds of data for years. The error happens on the PdfDocument Close() call, that leads to a RotateAnnotations call, that calls writer.AddToBody, and eventually GetNewObjectNumber in the PdfWriter is called and that method looks like this: protected internal virtual int GetNewObjectNumber(PdfReader reader, int number, int generation) { return currentPdfReaderInstance.GetNewObjectNumber(number, generation); } At the time the call is made, the currentPdfReaderInstance is null causing the exception. I looked at the code in the repository for the latest, and this method has not changed. I patched the code to check for null as such: protected internal virtual int GetNewObjectNumber(PdfReader reader, int number, int generation) { if (currentPdfReaderInstance == null) { currentPdfReaderInstance = reader.GetPdfReaderInstance(this); } return currentPdfReaderInstance.GetNewObjectNumber(number, generation); } This creates proper output. My question is, is this an acceptable patch or should this be handled differently? Furthermore, it worries me that this has not come up before - is it normal that the currentPdfReaderInstance is null under these circumstances? I have not tried this under 5.0.2 but I suspect that the same thing will happen - would it make sense to patch the latest? Any feedback would be appreciated. Thanks - Gylfi -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Re: [iText-questions] PdfStamper vs PdfReader page size
Ah good catch. PdfDocument is a subclass of Document... which is used to build new files. I'd image it's still the default size, whereas the reader.getPageSize() will actually look at the page in question. PS: getPageSize is looking at the page's Media Box. It ignores all the other boxes a page might have (crop box being the most common), as well as the page's rotation. --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; DisclaimerCardiff DisCard = null; From: Paulo Soares [mailto:psoa...@glintt.com] Sent: Wednesday, August 04, 2010 1:32 AM To: Post all your questions about iText here Subject: Re: [iText-questions] PdfStamper vs PdfReader page size page.getPdfDocument() doesn't make sense in this context where you don't really have a PdfDocument to write to. Paulo From: Karol Bryd [mailto:karo...@gmail.com] Sent: Tuesday, August 03, 2010 9:49 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] PdfStamper vs PdfReader page size Hello Perhaps this is a silly question but I am still going to ask it :-) I have a following code fragment: public static void main( String[] args ) throws Exception { PdfReader reader = new PdfReader(/tmp/input.pdf); File tmpFile = File.createTempFile(tmp_stamper, .pdf); System.out.println(Reader page size + reader.getPageSize(1).getWidth() + x + reader.getPageSize(1).getHeight()); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(tmpFile)); System.out.println(Stamper Size + stamper.getWriter().getPageSize().getWidth() + x + stamper.getWriter().getPageSize().getHeight()); Image img = Image.getInstance(http://kombajn.ath.cx/test.jpg;); img.setAbsolutePosition(0, 0); for(int n = 1; n reader.getNumberOfPages(); n++) { PdfContentByte page = stamper.getUnderContent(n); // img.scaleAbsolute(stamper.getReader().getPageSize(n).getWidth(), stamper.getReader().getPageSize(n).getHeight()); // THIS WORKS FINE img.scaleAbsolute(page.getPdfDocument().getPageSize().getWidth(), page.getPdfDocument().getPageSize().getHeight()); // THIS DOESN'T page.addImage(img); } stamper.close(); reader.close(); } The input focument /tmp/input.pdf is a simple PDF document with pages which have 612x792 pixels (US Letter Portrait). Question is: why page size retrieved from PdfStamper differes from page size from the PdfReader? This code when run will output this: Reader page size 612.0x792.0 Stamper Size 595.0x842.0 and the img.scaleAbsolute will not work correctly when the page size is taken from the page.getPdfDocument().getPageSize() but it will work just fine when width and height is from the PdfReader? Why is that? Thanks Karol 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. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.851 / Virus Database: 271.1.1/3047 - Release Date: 08/03/10 21:45:00
Re: [iText-questions] Null pointer exception in PdfWriter
This area was extensively changed in 5.0.3 (when it's out this weekend but you can get it from the SVN), it would be worth to see if the problem is already fixed. Paulo -Original Message- From: Gylfi Ingvason [mailto:gylfi.ingva...@solimarsystems.com] Sent: Wednesday, August 04, 2010 4:52 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] Null pointer exception in PdfWriter Gents, I'm using an older version of iTextSharp (4.1.6 equivalent), and recently ran into a null pointer exception in PdfWriter while splitting a PDF file. Never seen this before despite running all kinds of data for years. The error happens on the PdfDocument Close() call, that leads to a RotateAnnotations call, that calls writer.AddToBody, and eventually GetNewObjectNumber in the PdfWriter is called and that method looks like this: protected internal virtual int GetNewObjectNumber(PdfReader reader, int number, int generation) { return currentPdfReaderInstance.GetNewObjectNumber(number, generation); } At the time the call is made, the currentPdfReaderInstance is null causing the exception. I looked at the code in the repository for the latest, and this method has not changed. I patched the code to check for null as such: protected internal virtual int GetNewObjectNumber(PdfReader reader, int number, int generation) { if (currentPdfReaderInstance == null) { currentPdfReaderInstance = reader.GetPdfReaderInstance(this); } return currentPdfReaderInstance.GetNewObjectNumber(number, generation); } This creates proper output. My question is, is this an acceptable patch or should this be handled differently? Furthermore, it worries me that this has not come up before - is it normal that the currentPdfReaderInstance is null under these circumstances? I have not tried this under 5.0.2 but I suspect that the same thing will happen - would it make sense to patch the latest? Any feedback would be appreciated. Thanks - Gylfi 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. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] 4 pdf's per page
I am going to have to scale 4 pdf pages down and combine them into a single pdf page. Can anyone tell me where to look in the iText in Action book to find information related to this? I looked at scaling as it applies to images and the possibility of putting scaled down images in tables but am unsure if this is the right path. I am also unsure if scaling works the same for a pdf using PdfCopy for instance as it does for an image. Just need to be pointed in the right direction. Also I am currently constrained to using the 2.1.x version at this time. Edward W. Rouse Comsquared System, Inc. 770-734-5301 -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] Missing line on page break
Hello, this is a follow up to my previous query. To recap: I have issues with missing lines in a PdfPCell if it spans a page break. Seems related to this issue: http://old.nabble.com/Some-text-is-missing-when-converting-from-HTML-to-PDF!-to28864202.html I've noticed two cases where that might happen, if I set a vertical padding on the cell, or when I set certain font sizes. I've confirmed this behaviour on: iTextSharp 5.0.2 iTextSharp trunk iText 5.0.3 As before, thanks for any assistance. Code demonstrating problem with setting vertical padding (for iText): import java.io.FileNotFoundException; import java.io.FileOutputStream; import com.itextpdf.text.*; import com.itextpdf.text.pdf.*; class PdfTest1 { public static void main(String[] args) { try { Document doc = new Document(PageSize.A4); PdfWriter.getInstance(doc, new FileOutputStream(pdftest1.pdf)); doc.open(); PdfPTable table = new PdfPTable(1); PdfPCell cell = new PdfPCell(); cell.setPaddingBottom(20); String content = ; for (int i = 1; i = 50; i++){ content += Line + i + \n; } cell.addElement(new Paragraph(content)); table.addCell(cell); doc.add(table); doc.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } } } -- Ho Tzin Mein Kido Technologies Pte Ltd tzinm...@kidotech.com Mobile: 65 98336652 Office: 65 62936275 Fax: 65 62936256 -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
[iText-questions] [SPAM]
http://belaites.pillprescriptionstorehealth.net -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/