chengse66 / alivepdf

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

RESIZE.FIT_TO_PAGE for bigger images #299

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create an image bigger than the page size and transform it to b:ByteArray
2. use pdf.addImageStream(b, ColorSpace.DEVICE_RGB, new 
Resize(Mode.FIT_TO_PAGE, Position.LEFT))
3. save file fileStream.writeBytes(this.pdf.save(Method.LOCAL));

What is the expected output? What do you see instead?
image to be downsized to fit to page

What version of the product are you using? On what operating system?
rc 0.1.5

Please provide any additional information below.

case ratio > 1 should be handled in the following snippet, in the placeImage 
function:

 if ( resizeMode.mode == Mode.FIT_TO_PAGE )
            {           
                var ratio:Number = Math.min ( realWidth/image.width, realHeight/image.height );

                if ( ratio < 1 )
                {
                    width *= ratio;
                    height *= ratio;
                }
            }

Original issue reported on code.google.com by marcperm...@gmail.com on 4 Feb 2011 at 1:08