Your code: Image image = barcode.createImageWithBarcode(pdfContentByte, null, null); image.setAbsolutePosition(100,100); pdfContentByte.addImage(image);
works. The reference point is the bottom left corner of the image. If you want the reference to be the top left corner: image.setAbsolutePosition(100, 100 - image.getScaledHeight()); Best Regards, Paulo Soares ----- Original Message ----- From: "Teri" <[EMAIL PROTECTED]> To: "'Paulo Soares'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, July 17, 2003 21:10 Subject: RE: [iText-questions] Re: iText-questions digest, Vol 1 #1347 - 14 msgs > Ok thanks. Actually my problem is that I cannot get the barcode to > display at the correct top and left position on the pdf document. I > tried three different possible ways of getting this to work as noted > below and no luck. Could you provide some example code to generate the > barcode and get it to appear in a specified location on a document? I am > currently using a contentByte to position everything else on the > document and would be great if I could use that same contentByte to > position the barcode, but whatever works... > > Thanks, > Teri > > -----Original Message----- > From: Paulo Soares [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 17, 2003 12:50 PM > To: Teri Radichel; [EMAIL PROTECTED] > Subject: Re: [iText-questions] Re: iText-questions digest, Vol 1 #1347 - > 14 msgs > > > You don't need placeBarcode, the work was already done in the > createImageWithBarcode. > > Best Regards, > Paulo Soares > > ----- Original Message ----- > From: "Teri Radichel" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, July 17, 2003 17:58 > Subject: [iText-questions] Re: iText-questions digest, Vol 1 #1347 - 14 > msgs > > > > Hi, > > > > I am trying to put a barcode on a page and having problems. I can get > > the barcode to appear, however I cannot figure out how to position it > > correctly. I have tried three different ways - with the document.add > > example in the tutorial the barcode appears correctly but I can't > > figure > > > > out how to position it. When I use "placeBarcode" or > > PDFContentByte.addImage(barcodeImage) my whole document is blank. I > > did get one error message once that said something like invalid > > operation "q" but it's not consistent. Here is the code: > > > > public void addBarCode(String text, double top, double left) > > { > > try > > { > > float x = inchesToPoints(left); > > float y = inchesToPoints(top); > > > > BarcodePostnet barcode = new BarcodePostnet(); > > barcode.setCodeType(barcode.POSTNET); > > barcode.setCode(text); > > Image image = > > barcode.createImageWithBarcode(pdfContentByte, > > > > null, null); > > image.setAbsolutePosition(100,100); > > pdfContentByte.addImage(image); > > > > //when i use this next line of code the whole document > > //is blank - everything else i am putting on there > > //disappears..... > > //barcode.placeBarcode(pdfContentByte, null, null); > > > > //this works but I can't get the barcode to show up > > //in the right place on the page... > > //document.add(new Phrase(new Chunk(image, 0, 0))); > > > > > > } > > catch(Exception de) > > { > > de.printStackTrace(); > > } > > } > > > > Thanks, > > Teri > > > > [EMAIL PROTECTED] wrote: > > > > >Send iText-questions mailing list submissions to > > >[EMAIL PROTECTED] > > > > > >To subscribe or unsubscribe via the World Wide Web, visit > > >https://lists.sourceforge.net/lists/listinfo/itext-questions > > >or, via email, send a message with subject or body 'help' to > > >[EMAIL PROTECTED] > > > > > >You can reach the person managing the list at > > >[EMAIL PROTECTED] > > > > > >When replying, please edit your Subject line so it is more specific > > >than "Re: Contents of iText-questions digest..." > > > > > > > > >Today's Topics: > > > > > > 1. Xml concern (Mark Goking) > > > 2. ExceptionConverter: org.xml.sax.SAXParseException: Illegal > > character or entity reference syntax. (Mark Goking) > > > 3. Re: Compare PDF documents (Leonard Rosenthol) > > > 4. Is this a lack of iText's feature? Or is it my code (Mark > Goking) > > > 5. javadocs (Yuan Chang) > > > 6. Re: javadocs (Bruno Lowagie) > > > 7. Re: How to create bookmark that points to a table with custom > > > outline name (Cosmin Popa) > > > 8. Re: How to create bookmark that points to a table > > > with custom outline name (Bruno Lowagie) > > > 9. Re: Xml concern (Paulo Soares) > > > 10. Re: Ideas to accomplish modified "keep together" and add > > background image? (Paulo Soares) > > > 11. Re: How to create bookmark that points to a table with custom > > outline name (Bruno) > > > 12. Re: Xml concern (Grzegorz Kucner) > > > > > >--__--__-- > > > > > >Message: 1 > > >Date: Thu, 17 Jul 2003 00:45:39 +0800 > > >From: "Mark Goking" <[EMAIL PROTECTED]> > > >To: "Bruno" <[EMAIL PROTECTED]> > > >Cc: <[EMAIL PROTECTED]> > > >Subject: [iText-questions] Xml concern > > > > > > > > >My ResourceBundle class uses a UTF-8 saved property file to retrieve > > >the values and write them to the xml file also saved as utf-8 > > > > > >This is my line code to create the xml file > > > > > > write =3D new PrintWriter(new OutputStreamWriter(new > > >FileOutputStream(xmlFile), "UTF-8")); > > > > > > > > >Now, when I checked the generated xml file, it seems that some > > >characters have become garbled and not seen as the supposed unicode > > >symbol representation > > > > > >Do you think I should use another class to write a utf-8 saved xml > > >file before converting it to pdf? Could you please give an example? > > > > > > > > >--- > > >Outgoing mail is certified Virus Free. > > >Checked by AVG anti-virus system (http://www.grisoft.com). > > >Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 =20 > > > > > > > > >--__--__-- > > > > > >Message: 2 > > >Date: Thu, 17 Jul 2003 00:06:08 +0800 > > >From: "Mark Goking" <[EMAIL PROTECTED]> > > >To: <[EMAIL PROTECTED]> > > >Subject: [iText-questions] ExceptionConverter: > > org.xml.sax.SAXParseException: Illegal character or entity reference > > syntax. > > > > > >ExceptionConverter: org.xml.sax.SAXParseException: Illegal character > > >or entity reference syntax. > > > > > >This error appears once my application converts the xml file to pdf. > > >The xml is written as UTF-8. any idea what this exception means? > > > > > >Mark > > > > > >--- > > >Outgoing mail is certified Virus Free. > > >Checked by AVG anti-virus system (http://www.grisoft.com). > > >Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 =20 > > > > > > > > >--__--__-- > > > > > >Message: 3 > > >Date: Thu, 17 Jul 2003 00:33:27 -0400 > > >To: "Andreas Probst" <[EMAIL PROTECTED]>, > > >[EMAIL PROTECTED] > > >From: Leonard Rosenthol <[EMAIL PROTECTED]> > > >Subject: Re: [iText-questions] Compare PDF documents > > > > > >At 9:47 PM +0200 7/16/03, Andreas Probst wrote: > > > > > > > > >>I'm developing an application which creates PDF files. > > >> > > >> > > > > > > OK. > > > > > > > > > > > > > > >>To automatically test this application, I'd need to compare PDF > > >>documents, i.e. compare the current output of the app to once > > >>created and verified reference files. > > >> > > >> > > > > > > What would you compare? Visible output? Structure? Both? > > > > > > > > > > > > > > >> Unfortunately two PDF files seem to be never binary equal, even if > > > >>they look the same on the screen or on paper. > > >> > > >> > > > > > > Correct. PDF files are quite complex entities and it is > > >possible to have two files that are NOTHING alike in their file > > >format, but produce the same visible results. > > > > > > > > > > > > > > > > > >>Is it possible to compare two files with iText? > > >> > > >> > > > > > > No. > > > > > > The only thing that attempts this is Adobe Acrobat... > > > > > > > > >Leonard > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: VM Ware > > With VMware you can run multiple operating systems on a single > > machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual > > machines at the same time. Free trial click here: > > http://www.vmware.com/wl/offer/345/0 > > _______________________________________________ > > iText-questions mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > > ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
