{oapdf_gg}
In addition to the PDF document where the image existing outside draw, PDF module also provides a number of functions to enable us to draw geometric shapes. For example: a straight line, round, rectangular and other geometric patterns, following a straight line is drawn for some of the implementation: $ pdf = PDF_new (); //set line color //placed in the upper left corner of a Logo logo //in the Logo to draw a straight line under the logo //in the bottom of the page to draw a straight line another //output some text from the above example can be seen, it is necessary to draw a straight line can function only need three: PDF_moveto (), PDF_lineto () and PDF_stroke (). The above example is the first PDF_moveto ($ pdf, 20, 780) function to move the cursor to coordinates (20,780), then PDF_lineto ($ pdf, 575, 780) the definition of linear function of the coordinates of a point (575, 780), and finally with PDF_stroke ($ pdf) painting round. A function of the color settings PDF_setcolor ($ pdf, "stroke", "rgb", 0, 0, 0) There are several parameters, including the color-filled pattern of stroke, fill, both the three options, colors, or RGB can be CMYK color value color scheme. It is worth noting that: PDF_setcolor () function used in the percentage of value is the color, that is the brightness of the color, such as: If you want to set to red (RGB: 255,0,0), you can write: PDF_setcolor ($ pdf, "stroke", "rgb", 1, 0, 0), yellow if you want to set, it can be: PDF_setcolor ($ pdf, "stroke", "rgb", 1, 1, 0). to paint with color-filled rectangular and circular, you can use the following methods: //set the fill color //set the border line color //draw rectangle, behind the lower-left corner of the four parameters are the coordinates of X, Y and width, height //draw circle, the parameters are the center coordinates and radius of a circle In addition, PDFLib written document also provides summary information of the function, the function PDF_set_info_ * () at the beginning, this information may include: documentation of the author, title, content, theme and so on. Here are a few commonly used functions: PDF_set_info_author ($ pdf, "net_lover"); when using Acrobat Reader to open this document, the menu "File" - "Document Properties" - "Abstract" and will be able to see the information written into. Generator |