Page 308 - Open Soource Technologies 304.indd
P. 308

Web Technologies-I



                   Notes
                                               Nonproportional scaling

                                 <?php
                                 $im = pdf_open_jpeg($p, “php-big.jpg”);
                                 pdf_place_image($p, $im, 200, 700, 1.0);

                                 pdf_save($p); // Save current coordinate system settings
                                 $nx = 50/pdf_get_value($p,”imagewidth”,$im);

                                 $ny = 100/pdf_get_value($p,”imageheight”,$im);
                                 pdf_scale($p, $nx, $ny);
                                 pdf_place_image($p, $im, 200/$nx, 600/$ny, 1.0);

                                 pdf_restore($p); // Restore previous
                                 pdf_close_image ($p,$im);

                                 ?>
                                 The output of Example is shown in Figure 12.8.

                                                        Figure 12.8: Nonproportional Scaling

































                                                The scale parameter indicates the proportional scaling factor to be used when
                                                placing the image in the document.

                                 12.4.2 Graphics

                                 To  draw  a  graphical  shape,  first  specify  a  path  and  then  fill  and/or  stroke  the  path  with
                                 appropriately configured  fill  and/or stroke  colors. The  functions that  define  these paths are
                                 straightforward. For example, to draw a line, you position the cursor at the starting point of the
                                 line using a call to pdf_moveto( ), then specify the path for this line with a call to pdf_lineto( ).



        302                               LOVELY PROFESSIONAL UNIVERSITY
   303   304   305   306   307   308   309   310   311   312   313