I see. So it will be similar to PdfGraphics2D.drawImage(...)? Should I just switch to use PdfGraphics2D instead of using document.addImage(...)?
Also, is the PdfContentByte.concatCTM(...) not supposed to work with adding images (even though images might be upside-down)? Why did the online example used it? Thanks a lot! - Hao Paulo Soares-3 wrote: > > This is not really trivial: text, images and paths must be treated > differently. Look at the code of PdfGraphics2D where it's implemented. > > Paulo > > ----- Original Message ----- > From: "Hao Chen" <[email protected]> > To: <[email protected]> > Sent: Thursday, April 02, 2009 4:54 PM > Subject: [iText-questions] How to make (0, 0) start at upper-left? > > > > I'm trying to generate a PDF from drawing data that uses coordinates start > at > upper-left corner. I tried to use concatCTM in the online example, but it > doesn't seem to work for me, the images are still placed using coordinates > starting from lower-left corner. Anything wrong about what I'm doing? > > An additional question is that if the y-axis is reversed, will the image > display upside-down? If so, is there any simple/better way to make things > display using the traditional upper-left coordinates or I have to do the > position calculations myself without using the transformation? Thanks in > advance! > > Code: > > Document document = new Document(); > PdfWriter writer = PdfWriter.getInstance(document, new > FileOutputStream("test-out.pdf")); > document.open(); > PdfContentByte cb = writer.getDirectContent(); > cb.concatCTM(1f, 0f, 0f, -1f, 0f, PageSize.A4.getHeight()); > > Image image = Image.getInstance(imagePath); > image.setAbsolutePosition(0, 500); > document.add(image); > > document.close(); > > -- > View this message in context: > http://www.nabble.com/How-to-make-%280%2C-0%29-start-at-upper-left--tp22850516p22850516.html > Sent from the iText - General mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > > > ------------------------------------------------------------------------------ > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > > -- View this message in context: http://www.nabble.com/How-to-make-%280%2C-0%29-start-at-upper-left--tp22850516p22855326.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
