Hello all, I'd like to apply annotations at specified locations on a pdf page, but I'd like to transform the coordinate system beforehand. I've tried both PdfContentByte.SetTextMatrix and PdfContentByte.ConcatCTM (with arguments (0, -1, 1, 0, 0, img.Width), which should rotate it 270 degrees and translate it back into the first quadrant), but in both cases a rectangle placed at (20, 20) still showed up in the lower left corner. What am I doing wrong? Am I right that there are 2 sets of coordinate systems, one for text and one for images? Which one applies to annotations? Or is there a third one?
Thanks, Brian ------------------------------------------------- C# sample code: public static void MakeImagePDF(Stream outStream) { Document document = new Document(PageSize.LETTER.Rotate()); PdfWriter writer = PdfWriter.GetInstance(document, outStream); document.Open(); foreach (string filename in new string[] { "d:\\temp\\sample1.tif", "d:\\temp\\desktop.tif"}) { using (Stream imgStream = new FileStream(filename, FileMode.Open)) { Image img = Image.GetInstance(imgStream); img.RotationDegrees = 270; img.ScalePercent(72f / img.DpiX * 100); // TODO: handle mismatched dpi img.SetAbsolutePosition(0, 0); Rectangle r = new Rectangle(img.ScaledWidth, img.ScaledHeight); Rectangle pageSize = new Rectangle(0, 0, 72 * img.Width / img.DpiX, 72 * img.Height / img.DpiY).Rotate(); document.SetPageSize(pageSize); document.NewPage(); document.Add(img); PdfContentByte content = writer.DirectContent; content.SaveState(); content.ConcatCTM(0, -1, 1, 0, 0, img.Width); // content.SetTextMatrix(0, -1, 1, 0, 0, img.Width); iTextSharp.text.pdf.PdfAnnotation annot = iTextSharp.text.pdf.PdfAnnotation.CreateSquareCircle(writer, new Rectangle(20, 20, 40, 60), "Hello", true); annot.Color = Color.BLUE; writer.AddAnnotation(annot); content.RestoreState(); } } document.Close(); } ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/