Am 06.12.2018 um 18:31 schrieb Mark Gargan:
Hi Tilman,

                 Thanks very much for the quick response Tilman. Alas I can't 
upload the document as it's a company doc.
If I might could I provide a (very) rough dimensions diagram of the original 
page? Where the divide by 72 is the assumption that there are 72 pixels per 
inch?


Yes - 1/72 inch = 1 page unit.


The outer box is the image I'm super imposing into the inner.

                                    2480/72 (34.4)
             ^                   --------------------
             |                  |        8.86        |
             |                  |  --------------   |      ^
             |                  |  |                |  |      |
3508/72( 48.72)   |  |                |  |      |
             |                  |  |                |  |      12.6
             |                  |  |                |  |      |
             |                  |  |                |  |      |
             |                  |  ---------------  |      V
                                 --------------------

I would have figured the [X,Y] scaling should be [34.4/8.86 * 100 , 
11.69/12.6*100 ]

But I appear to be out by almost a factor of 2 in my scaling with those 
figures. Also the image appears in the bottom left hand corner.


Yes that is why you must do a translation too. That's the two last parameters.

Your image dimensions sound like 300dpi. So you'd have to scale, probably divide by 300 then multiply by 72.


Tilman



Thanks,
Mark.

-----Original Message-----
From: Tilman Hausherr [mailto:thaush...@t-online.de]
Sent: 06 December 2018 17:15
To: users@pdfbox.apache.org
Subject: Re: AffineTransform

Hi,

You didn't upload the PDF, attachments don't go through.

Please mention what PDFBox version you are using (hopefully 2.0.13) and include 
your code. I assume you want to draw an image. If you would use

2480 0 0 3508 0 0

Then the image would appear at the original size. So 700 0 0 700 x y will have 
a weird effect.

The coordinates start at the bottom left.

"it's quite unintuitive to place two shearing factors between two scaling" 
complain to the designers of the java language :-) Tilman

Am 06.12.2018 um 17:55 schrieb Mark Gargan:
Hi folks,

              I'm trying to work with the Affine transform to superimpose a 
snapshot of an A4 document into an SRA3 document which has crop lines.

The SRA3 template size is or  (8.86in x 12.6in) in inches. The original A4 
document I'm taking the snapshot of is typical A4 ( 8.27in × 11.69in).

I've taken a snapshot of the first page of the A4 original document and it 
produces an image in typical A4 size 2480 X 3508 pixels.

I'm trying to figure out the AffineTransform that will place the A4 snapshot 
into the centre of the SRA3 document and within the croplines.

So far I have

AffineTransform at = new AffineTransform(700, 0, 0, 700, 100, 200);

with the Affine constructor as follows


*
* @param m00 the X coordinate scaling element of the 3x3 matrix
* @param m10 the Y coordinate shearing element of the 3x3 matrix
* @param m01 the X coordinate shearing element of the 3x3 matrix
* @param m11 the Y coordinate scaling element of the 3x3 matrix
* @param m02 the X coordinate translation element of the 3x3 matrix
* @param m12 the Y coordinate translation element of the 3x3 matrix
* @since 1.2
*/
@ConstructorProperties({ "scaleX", "shearY", "shearX", "scaleY",
"translateX", "translateY" }) public AffineTransform(float m00, float m10,
                         float m01, float m11,
                         float m02, float m12) {

I.e. x-scaling, y-shearing, x-shearing, y-scaling, x-translation,
y-translation

I guess the questions are


    1.  Why the signature was presented like this, it's quite unintuitive to 
place two shearing factors between two scaling.
    2.  Also I can't understand why the x & y scaling factors need to be in the 
hundreds. i.e. 700 and 700
    3.  The translation factors, are they taken from the top right of the 
image/object being imported or from the centre?

Thanks in advance for any help folks,
Mark.




Aviva Insurance Limited, trading as Aviva, is authorised by the Prudential 
Regulation Authority in the UK and is regulated by the Central Bank of Ireland 
for conduct of business rules.

Registered Branch Office in Ireland No 900175, Registered Branch Address One 
Park Place, Hatch Street, Dublin 2. Registered in Scotland No 2116. Registered 
Office Pitheavlis, Perth, PH2 0NH.

Aviva Direct Ireland Limited is regulated by the Central Bank Of Ireland. A 
private company limited by shares. Registered in Ireland No 374895. Registered 
Office One Park Place, Hatch Street, Dublin 2.

Aviva Life & Pensions UK Limited, trading as Aviva Life & Pensions Ireland, is 
authorised by the Prudential Regulation Authority in the UK and is regulated by the 
Central Bank of Ireland for conduct of business rules.

Aviva Life & Pensions UK Limited, trading as Aviva Life & Pensions Ireland, is 
also regulated in the UK: by the Prudential Regulation Authority for prudential rules 
and, to a limited extent, by the Financial Conduct Authority for applicable UK conduct 
rules.
Registered Branch Office in Ireland (No 906464) at One Park Place,
Hatch Street, Dublin 2. Registered in England (3253947) at Wellington
Row, York, YO90 1WR

Aviva Life Services Ireland Limited is regulated by the Central Bank Of 
Ireland. A private company limited by shares. Registered in Ireland No 406616. 
Registered Office One Park Place, Hatch Street, Dublin 2.


www.aviva.ie

The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
or reliance upon this information by persons or entities other than the 
intended recipient is prohibited. If you received this in error, please contact 
the sender and delete the material from your computer.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Aviva Insurance Limited, trading as Aviva, is authorised by the Prudential 
Regulation Authority in the UK and is regulated by the Central Bank of Ireland 
for conduct of business rules.

Registered Branch Office in Ireland No 900175, Registered Branch Address One 
Park Place, Hatch Street, Dublin 2. Registered in Scotland No 2116. Registered 
Office Pitheavlis, Perth, PH2 0NH.

Aviva Direct Ireland Limited is regulated by the Central Bank Of Ireland. A 
private company limited by shares. Registered in Ireland No 374895. Registered 
Office One Park Place, Hatch Street, Dublin 2.

Aviva Life & Pensions UK Limited, trading as Aviva Life & Pensions Ireland, is 
authorised by the Prudential Regulation Authority in the UK and is regulated by the 
Central Bank of Ireland for conduct of business rules.

Aviva Life & Pensions UK Limited, trading as Aviva Life & Pensions Ireland, is 
also regulated in the UK: by the Prudential Regulation Authority for prudential rules 
and, to a limited extent, by the Financial Conduct Authority for applicable UK conduct 
rules.
Registered Branch Office in Ireland (No 906464) at One Park Place, Hatch 
Street, Dublin 2. Registered in England (3253947) at Wellington Row, York, YO90 
1WR

Aviva Life Services Ireland Limited is regulated by the Central Bank Of 
Ireland. A private company limited by shares. Registered in Ireland No 406616. 
Registered Office One Park Place, Hatch Street, Dublin 2.


www.aviva.ie

The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
or reliance upon this information by persons or entities other than the 
intended recipient is prohibited. If you received this in error, please contact 
the sender and delete the material from your computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to