This is the code I'm working with right now: // Image width (in pixels) (image saved at 72 DPI) int image_width = 500;
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; ) { // Current page number page = positions[ n++ ]; // Page width (in points) page_width = reader.getPageSize( (int) page ).getWidth(); // Modifier mod = image_width / page_width; // Output to consol System.out.println( "Type: " + getFieldTypeAsString( form.getFieldType( key ) ) ); System.out.println( "Page: " + page ); System.out.println( "Left: " + (int) ( positions[ n++ ] / mod ) + "px" ); System.out.println( "Bottom: " + (int) ( positions[ n++ ] / mod ) + "px" ); System.out.println( "Right: " + (int) ( positions[ n++ ] / mod ) + "px" ); System.out.println( "Top: " + (int) ( positions[ n++ ] / mod ) + "px" ); } } I'm generating images of all PDF's to 500px width at 72 DPI. So based off that, I'm trying to convert points to pixels to position things over the image outside of the PDF. So basically I'm trying to say if I'm saving a PDF at 600 pts, to a 500px image at 72 DPI, based off this information I should be able to calculate the exact pixels from points. Maybe what I did above is working, but when I check the positions in pixels of the image to what I'm getting, they aren't correct. To give you a bit of a case study of what I'm doing, although it doesn't have to do 100% with iText, but it might give you a better idea of what I'm trying to do: Imagine you upload a PDF to a HTML form, once it's done processing you see an image of the PDF you uploaded with HTML forms in the same spot that the AcroFields were. Hopefully that gives you a bit more understanding of what I'm trying to do. Once again thank you very much for taking the time to help me out. 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-tp25094167p25094853.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/