I'm actually using the code from the iText in Action book: AcroFields form = reader.getAcroFields(); HashMap fields = form.getFields();
System.out.println( "Empty: " + fields.isEmpty() ); String key; for ( Iterator i = fields.keySet().iterator(); i.hasNext(); ) { key = (String) i.next(); System.out.println( key ); float[] positions = form.getFieldPositions( key ); for ( int n = 0; n < positions.length; ) { System.out.println( "Type: " + getFieldTypeAsString( form.getFieldType( key ) ) ); System.out.println( "Page: " + positions[ n++ ] ); System.out.println( "Left: " + positions[ n++ ] ); System.out.println( "Bottom: " + positions[ n++ ] ); System.out.println( "Right: " + positions[ n++ ] ); System.out.println( "Top: " + positions[ n++ ] ); } } to get the positions of the forms. Now screen resolution shouldn't matter as I'm saving the PDF as images at 72 DPI. Basically what I'm trying to do is take snapshots of a PDF (images, this is already done) and then take positions from iText and put markers over these fields but not in iText, but using JavaScript. I know JavaScript isn't related to this forum, I was just giving you a bit more detail on what my overall goal is. Now I already use ImageMagick to render images from the PDF, I set it to 72 DPI so that points=pixels. Although now that I think about it, since an image can be resized to 100 pixels and still be 72 DPI, the position wouldn't match at all. I'm basically trying to figure out how I can match the points to pixels. I know this is vague, I really don't know how to explain it better without getting off topic to iText. This is just theory, but maybe I should be taking the total width of the PDF in points, that is where points = pixels, then when I generate the images of the PDF, I'm obviously shrinking the PDF to a smaller size, so then I should figure out how much I'm shrinking it, and then use that as a modifier in my points = pixels. This probably doesn't make sense at all, I'll continue with the theory and post back. 1T3XT info wrote: > > Jacob- wrote: >> I have a library of user submitted PDF's which can contain an infinite >> amount of pages & AcroFields. I'm using iText to grab the positions of >> these AcroFields. > > More or less like what is done here: http://1t3xt.be/?X00004a > The positions of one field in file register_form2.pdf are grabbed > and an image is added at those coordinates: registered2.pdf > >> Now this is where ImageMagick comes into play, I'm using >> ImageMagick to generate images that will always be at 600px width (for >> consistency of this post) at 72 DPI. Now, from what I've read there are >> 72 >> points per inch, if I'm rendering the photo at 72 pixels per inch, then 1 >> pixel should equal 1 point. (If I'm wrong about this, please let me >> know). > > It depends... What are we talking about? > Measurements on the page, or resolution? > > If you draw a line with a length of 72 user units, > you're drawing a line that measures an inch. > > The screen resolution is something else. > Go to Edit > Preferences > Page Display > and you'll see that you can choose between: > Use system setting (in my case: 96 pixels/inch), or > Custom resolution (in my case: 110 pixels/inch). > > I'm not sure if the resolution is relevant for your question, but > maybe it is, because I'm not sure if I understand what you're asking. > >> Now I'm outputting the positions of the AcroFields and the positions >> don't >> seem to match that well to pixels on the actual document. > > Can you please provide a small standalone example so that we can > understand what is wrong? > -- > This answer is provided by 1T3XT BVBA > http://www.1t3xt.com/ - http://www.1t3xt.info > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > 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/ > > -- View this message in context: http://www.nabble.com/AcroForms%2C---ImageMagick-tp25094167p25094640.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php 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/