pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shivangi Singal <shivangi.sin...@microlistics.com.au>
Subject RE: PDFBox and Dimension
Date Thu, 12 Jan 2017 21:55:26 GMT
Thank you will give it a try.

From: Attila Kiss [mailto:kiss.attila1001@gmail.com]
Sent: Thursday, 12 January 2017 5:28 PM
To: users@pdfbox.apache.org; Shivangi Singal <shivangi.singal@microlistics.com.au>
Subject: Re: PDFBox and Dimension

I do not know if it is the perfect way, but I use this:
public class PDUnitsConverter {

    private static final float POINTS_PER_INCH = 72;
    private static final float MM_PER_INCH = 1 / (10 * 2.54f) * POINTS_PER_INCH;

            private PDUnitsConverter() {


            public static float convertMMToUnits(float mm) {
                        return mm * MM_PER_INCH;

            public static float convertUnitsToMM(float unit) {
                        return unit / MM_PER_INCH;


If you need a 148 mm horizontal line:
moveTo(x,y);    //start point of the line
//if the line is horizontal
lineTo(PDUnitsConverter.convertMMToUnits(148), y);

I hope it helps.

2017-01-12 5:22 GMT+01:00 Shivangi Singal <shivangi.singal@microlistics.com.au<mailto:shivangi.singal@microlistics.com.au>>:

To draw a line I am using moveTo and  lineTo , which is working fine  .
But If I have to draw a line which is 148 mm in dimension what would be the best way to do
that ?

Do I need experiment with x and y coordinates  to reach exact measurement or is there any
more better way ?

Will really appreciate your help.


Shivangi Singal
P:  +61 3 9326 7422<tel:+61%203%209326%207422>
M:  +61 421 996 537<tel:+61%20421%20996%20537>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message