galkahana / hummusrenderrer

NodeJS module for rendering PDF, using a document object/declarative method, using HummusJS
Apache License 2.0
16 stars 5 forks source link

Top alignment #3

Open raedle opened 9 years ago

raedle commented 9 years ago

Hi.

I am a bit confused about the top alignment of boxes. When I use a top alignment of 10px for a box, it starts rendering the box at the bottom of a document (see red rectangle in image). Am I wrong when assuming that it should render the box at 10px starting from top of the document?

Great tool!! Thanks in advance!

{
    "source":{
        "external":"pdfFile"
    },
    "externals": {
        "anshika":"https://raw.githubusercontent.com/galkahana/hummusrenderrer/master/samples/img1.jpg",
        "pdfFile": "http://www.ca7.uscourts.gov/rules/type.pdf"
    },
    "pages": [
        {
            "modifiedFrom": 0,
            "width": 595,
            "height": 842,
            "boxes": [
                {
                    "top": 10,
                    "left": 100,
                    "image": {
                        "external":"anshika",
                        "transformation": [0.1, 0, 0, 0.1, 0, 0]
                    }
                }
            ]
        }
    ]
}

hummusrendering

galkahana commented 9 years ago

A little bit. Coordinates are bottom left oriented. You may specify the top ir bottom of the box but it will be relative to the bottom left corner of the page. Just substract the top that you are using from the page height to get the correct measure. Gal.