Jeff-Lewis / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

Image size problem #112

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. dynamically loading an image
2. adding a page and Image like that
var myPDF:PDF = new PDF( Orientation.LANDSCAPE, Unit.POINT, Size.A4 );

myPDF.setDisplayMode ( Display.REAL,Layout.SINGLE_PAGE ); 

myPDF.addPage();

var breite:Number = container.width;
var hoehe:Number = container.height;
var xpos:Number = container.x;
var ypos:Number = container.y;

myPDF.addImage(container,xpos,ypos,breite,hoehe,"PNG",100,1,"NONE");

myPDF.save( Method.REMOTE,"generate2d.pdf", "create.php"  );

What is the expected output? What do you see instead?
Expected is a picture that is as large as it is in the swf and on the 
correct x/y coordinates. Instead I see a picture that is about 35-40% 
larger. If the image is not set to x=0 and y=0 parts of the image will be 
cropped.

What version of the product are you using? On what operating system?
Win XP, 0.1.4.8

thank you for your help!

Original issue reported on code.google.com by gerald.l...@aon.at on 23 Mar 2009 at 11:03

GoogleCodeExporter commented 8 years ago
I'm getting the same issue... Looking into the problem I believe it's because 
Flex 
uses pixels and the output is in points. The conversion between the two is:
points = pixels * 72 / ScreenDPI
On the Mac the standard ScreenDPI is 72 so this comes out as a 1:1 ratio, 
however, 
on Windows it's 96 meaning the image is larger than it should be.

Unfortunately, not only does this change between operating system, this is also 
user 
specific. Flex does have a function to return the ScreenDPI - 
Capabilities.ScreenDPI. However, there is a flash bug 
(http://bugs.adobe.com/jira/browse/SDK-13778) which always returns this as 72 
too!

Original comment by robert.c...@gmail.com on 1 Apr 2009 at 9:36

GoogleCodeExporter commented 8 years ago
override the addImage method and set the transformation matrix with 
matrix.createBox(ratio, ratio) when transformation is set to false (ratio is 
the reqd
width & height ratio of your image). Now in addImage set resize mode to
ResizeMode.NONE and set transformation parameter to false. This should fix the
problem hopefully.

Original comment by p.gau...@gmail.com on 10 Jul 2009 at 9:45