{oapdf_gg}
Chapter VI PhotoImage objectIf you have studied API, you may have noticed in several structure function can be to create a picture, this manual, we will tell you only the most simple solutions, such as access through the file name or URL of the image generated to determine the Image object. public static Image getInstance (Uri url) public static Image getInstance (string filename) Image is an abstract class, so examples of methods have been given to determine the type of picture (GIF, Jpeg, PNG ... ...) and return to the type of object Gif, Jpeg, Png ... ..., some pictures will be ignored, If you want to know what picture will be ignored, please refer to FAQ ( http ://www.lowagie.com/iText/faq.html # images ). u get picture through the URL example Image wmf = Image.getInstance (new URL ("../examples/harbour.wmf ")); Image gif = Image.getInstance (new URL ("../examples/vonnegut.gif ")); Image jpeg = Image.getInstance (new URL ("../examples/myKids.jpg ")); Image png = Image.getInstance (new URL ("../examples/hitchcock.png ")); Note:Many PDF library to insert a picture before and extract it into a bitmap format, the following is why I have a few reasons not to do so:
u get picture through the example of the file name picture by simply changing the path references to sample code 0601 into the sample code 0602: Image gif = Image.getInstance ( "vonnegut.gif "); Image jpeg = Image.getInstance ( "myKids.jpg "); Image png = Image.getInstance ( "hitchcock.png "); sample code with the only difference between the 0601 image from the local access only, while an example of sample code, see 0603. position pictureu alignment through the following methodspicture alignment settings: Alignment = Image.RIGHT Alignment = Image.MIDDLE Alignment = Image.LEFT see the sample code 0604. we will Vonnegut on the right side of the picture, the picture on the middle child, hitchcock's picture on the left. u picture and text In addition, you can also specify the text of the relative picture of the way around: Alignment = Image.RIGHT | Image.TEXTWRAP Alignment = Image.MIDDLE Alignment = Image.LEFT | Image.UNDERLYING see sample code 0506, text in the left picture Vonnegut is not in my plans of children around the Department, and the picture at the top of Hitchcock. Description:This feature is still some BUG. u absolute position when the production of PDF documents, you may use this method: public void setAbsolutePosition (int absoluteX, int absoluteY) will put a picture to an absolute position on the page code, see sample code of 0606, we added different coordinates of the two images, here given the coordinates of the picture on the lower left-hand corner, through the pictures width and height as the X and Y coordinates will be set up on the first picture, the coordinates of the second set 2 times the picture. |