1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422
|
<?xml version="1.0" encoding="utf-8"?>
<reference id="ref.pdf">
<title>PDF functions</title>
<titleabbrev>PDF</titleabbrev>
<partintro>
<sect1 id="pdf.intro">
<title>Introduction</title>
<simpara>
You can use the PDF functions in PHP to create PDF files if you
have the PDF library by Thomas Merz (available at
<ulink url="&url.pdf;">&url.pdf;</ulink>;
you will also need <ulink url="&url.jpeg;">the JPEG library</ulink>
and <ulink url="&url.tiff;">the TIFF library</ulink> to
compile this. These two libs also quite often make problems when
configuring php. Follow the messages of configure to fix possible
problems.
</simpara>
<simpara>
Please consult the excellent documentation for
pdflib shipped with the source distribution of pdflib.
It provides a very good overview of what pdflib capable of doing.
Most of the functions in pdflib
and the PHP module have the same name. The parameters are also
identical. You should also understand some of the concepts of PDF
or Postscript to efficiently use this module.
All lengths and coordinates are measured in Postscript points.
There are generally 72 PostScript points to an inch, but this
depends on the output resolution.
</simpara>
<simpara>
There is another PHP module for pdf document creation based on
<ulink url="&url.cpdf;">FastIO's</ulink>.
ClibPDF. It has a slightly different API. Check the
<link linkend="ref.cpdf">ClibPDF functions</link> section for
details.
</simpara>
<simpara>
The pdf module introduces two new type of variable.
It is called <parameter>pdfdoc</parameter>
<parameter>pdfdoc</parameter> is a pointer to a pdf document and
almost all functions need it as its first parameter.
</simpara>
</sect1>
<sect1 id="pdf.oldlibs.confusion">
<title>Confusion with old pdflib versions</title>
<simpara>
Since the very begining of PDF support in PHP — starting with
pdflib 0.6 —
there has been tons of changes especially to the pdflib API. Most of
these changes has been somehow covered by PHP, some has even required
changes to the PHP API. Since pdflib
3.x the API seems to be stabilzed and PHP 4 has adopted the version as a
minimum requirement for PDF support. The consequence will be that many
functions will disappear or be replaced by alternatives sooner or later.
Support for pdflib 0.6 is already completely given up.
The following table list all the functions which are deprecated
in PHP 4.02 and should be replaced by their new versions.
</simpara>
<para>
<table>
<title>Deprecated functions and its replacements</title>
<tgroup cols="2">
<thead>
<row>
<entry>Old function</entry>
<entry>Replacement</entry>
</row>
</thead>
<tbody>
<row>
<entry><function>pdf_put_image</function></entry>
<entry>Not needed anymore.</entry>
</row>
<row>
<entry><function>pdf_get_font</function></entry>
<entry><function>pdf_get_value</function> passing
<literal>"font"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_get_fontsize</function></entry>
<entry><function>pdf_get_value</function> passing
<literal>"fontsize"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_get_fontname</function></entry>
<entry><function>pdf_get_parameter</function> passing
<literal>"fontname"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_info_creator</function></entry>
<entry><function>pdf_set_info</function> passing
<literal>"Creator"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_info_title</function></entry>
<entry><function>pdf_set_info</function> passing
<literal>"Title"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_info_subject</function></entry>
<entry><function>pdf_set_info</function> passing
<literal>"Subject"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_info_author</function></entry>
<entry><function>pdf_set_info</function> passing
<literal>"Author"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_info_keywords</function></entry>
<entry><function>pdf_set_info</function> passing
<literal>"Keywords"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_leading</function></entry>
<entry><function>pdf_set_value</function> passing
<literal>"leading"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_text_rendering</function></entry>
<entry><function>pdf_set_value</function> passing
<literal>"textrendering"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_text_rise</function></entry>
<entry><function>pdf_set_value</function> passing
<literal>"textrise"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_horiz_scaling</function></entry>
<entry><function>pdf_set_value</function> passing
<literal>"horizscaling"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_text_matrix</function></entry>
<entry>Not available anymore</entry>
</row>
<row>
<entry><function>pdf_set_char_spacing</function></entry>
<entry><function>pdf_set_value</function> passing
<literal>"charspacing"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_word_spacing</function></entry>
<entry><function>pdf_set_value</function> passing
<literal>"wordspacing"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_transition</function></entry>
<entry><function>pdf_set_parameter</function> passing
<literal>"transition"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_set_duration</function></entry>
<entry><function>pdf_set_value</function> passing
<literal>"duration"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_open_gif</function></entry>
<entry><function>pdf_open_image_file</function> passing
<literal>"gif"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_open_jpeg</function></entry>
<entry><function>pdf_open_image_file</function> passing
<literal>"jpeg"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_open_tiff</function></entry>
<entry><function>pdf_open_image_file</function> passing
<literal>"tiff"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_open_png</function></entry>
<entry><function>pdf_open_image_file</function> passing
<literal>"png"</literal> as the second parameter.</entry>
</row>
<row>
<entry><function>pdf_get_imagewidth</function></entry>
<entry><function>pdf_get_value</function> passing
<literal>"imagewidth"</literal> as the second parameter and the image
as the third parameter.</entry>
</row>
<row>
<entry><function>pdf_get_imageheight</function></entry>
<entry><function>pdf_get_value</function> passing
<literal>"imageheight"</literal> as the second parameter and the
image as the third parameter.</entry>
</row>
<row>
<entry><function></function></entry>
<entry><function></function></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</sect1>
<sect1 id="pdf.install.pdflib">
<title>Hints for installation of pdflib 3.x</title>
<simpara>
Since version 3.0 of pdflib you should configure pdflib with the option
<literal>--enable-shared-pdflib</literal>.
</simpara>
</sect1>
<sect1 id="pdf.oldlibs.hints">
<title>Issues with older versions of pdflib</title>
<simpara>
If you use pdflib 2.01 check how the lib was installed.
There should be a file or a to link libpdf.so. Version 2.01 just creates
a lib with the name libpdf2.01.so which cannot be found when linking
the test programm in configure. You will have to create a symbolic
link from libpdf.so to libpdf2.01.so.).
</simpara>
<simpara>
Version 2.20 of pdflib has introduced more changes to its API and
support for chinese and japanese fonts. This unfortunately causes
some changes of the pdf module of php4 (not php3). If you use pdflib 2.20
handle the in memory generation of PDF documents with care. Until
pdflib 3.0 is released it might be unstable. The encoding parameter
of <function>pdf_set_font</function> has changed to a string. This
means that instead of e.g. 4 you have to use 'winansi'.
</simpara>
<simpara>
If you use pdflib 2.30 the <function>pdf_set_text_matrix</function>
will have gone. It is not supported any more. In general it is a good
advise to consult the release notes of the used version of pdflib
for possible changes.
</simpara>
<simpara>
Any version of PHP 4 after March, 9th 2000 do not support versions
of pdflib older than 3.0. PHP 3 on the other hand should not be used
with version newer than 2.01.
</simpara>
</sect1>
<sect1 id="pdf.examples">
<title>Examples</title>
<simpara>
Most of the functions are fairly easy to use. The most difficult part
is probably to create a very simple pdf document at all. The following
example should help to get started.
It creates the file <filename>test.pdf</filename>
with one page. The page contains the text "Times Roman outlined" in an
outlined, 30pt font. The text is also underlined.
</simpara>
<para>
<example>
<title>Creating a PDF document with pdflib</title>
<programlisting>
<?php
$fp = fopen("test.pdf", "w");
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
pdf_set_font($pdf, "Times-Roman", 30, "host");
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
fclose($fp);
echo "<A HREF=getpdf.php>finished</A>";
?>
</programlisting>
<simpara>
The script <filename>getpdf.php</filename> just returns the pdf document.
</simpara>
<informalexample>
<programlisting>
<?php
$fp = fopen("test.pdf", "r");
header("Content-type: application/pdf");
fpassthru($fp);
fclose($fp);
?>
</programlisting>
</informalexample>
</example>
</para>
<para>
The pdflib distribution contains a more complex example which
creates a serious of pages with an analog clock. This example
converted into PHP using pdflib looks as the following (you
can see the same example in the documentation for the
<link linkend="ref.cpdf">clibpdf module)</link>:
</para>
<para>
<example>
<title>pdfclock example from pdflib distribution</title>
<programlisting>
<?php
$pdffilename = "clock.pdf";
$radius = 200;
$margin = 20;
$pagecount = 40;
$fp = fopen($pdffilename, "w");
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Creator", "pdf_clock.php3");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Analog Clock");
while($pagecount-- > 0) {
pdf_begin_page($pdf, 2 * ($radius + $margin), 2 * ($radius + $margin));
pdf_set_parameter($pdf, "transition", "wipe");
pdf_set_value($pdf, "duration", 0.5);
pdf_translate($pdf, $radius + $margin, $radius + $margin);
pdf_save($pdf);
pdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);
/* minute strokes */
pdf_setlinewidth($pdf, 2.0);
for ($alpha = 0; $alpha < 360; $alpha += 6) {
pdf_rotate($pdf, 6.0);
pdf_moveto($pdf, $radius, 0.0);
pdf_lineto($pdf, $radius-$margin/3, 0.0);
pdf_stroke($pdf);
}
pdf_restore($pdf);
pdf_save($pdf);
/* 5 minute strokes */
pdf_setlinewidth($pdf, 3.0);
for ($alpha = 0; $alpha < 360; $alpha += 30) {
pdf_rotate($pdf, 30.0);
pdf_moveto($pdf, $radius, 0.0);
pdf_lineto($pdf, $radius-$margin, 0.0);
pdf_stroke($pdf);
}
$ltime = getdate();
/* draw hour hand */
pdf_save($pdf);
pdf_rotate($pdf,-(($ltime['minutes']/60.0)+$ltime['hours']-3.0)*30.0);
pdf_moveto($pdf, -$radius/10, -$radius/20);
pdf_lineto($pdf, $radius/2, 0.0);
pdf_lineto($pdf, -$radius/10, $radius/20);
pdf_closepath($pdf);
pdf_fill($pdf);
pdf_restore($pdf);
/* draw minute hand */
pdf_save($pdf);
pdf_rotate($pdf,-(($ltime['seconds']/60.0)+$ltime['minutes']-15.0)*6.0);
pdf_moveto($pdf, -$radius/10, -$radius/20);
pdf_lineto($pdf, $radius * 0.8, 0.0);
pdf_lineto($pdf, -$radius/10, $radius/20);
pdf_closepath($pdf);
pdf_fill($pdf);
pdf_restore($pdf);
/* draw second hand */
pdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
pdf_setlinewidth($pdf, 2);
pdf_save($pdf);
pdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
pdf_moveto($pdf, -$radius/5, 0.0);
pdf_lineto($pdf, $radius, 0.0);
pdf_stroke($pdf);
pdf_restore($pdf);
/* draw little circle at center */
pdf_circle($pdf, 0, 0, $radius/30);
pdf_fill($pdf);
pdf_restore($pdf);
pdf_end_page($pdf);
}
$pdf = pdf_close($pdf);
fclose($fp);
echo "<A HREF=getpdf.php?filename=".$pdffilename.">finished</A>";
?>
</programlisting>
<simpara>
The PHP script <filename>getpdf.php</filename> just outputs the pdf document.
</simpara>
<programlisting>
<?php
$fp = fopen($filename, "r");
header("Content-type: application/pdf");
fpassthru($fp);
fclose($fp);
?>
</programlisting>
</example></para>
</sect1>
</partintro>
<refentry id="function.pdf-set-info">
<refnamediv>
<refname>pdf_set_info</refname>
<refpurpose>Fills a field of the document information</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_info</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>fieldname</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_info</function> function sets an information field
of a pdf document.
Possible values for the fieldname are 'Subject', 'Title', 'Creator',
'Author', 'Keywords' and one user-defined name.
It can be called before beginning a page.
<example>
<title>Setting document information</title>
<programlisting>
<?php
$fd = fopen("test.pdf", "w");
$pdfdoc = pdf_open($fd);
pdf_set_info($pdfdoc, "Author", "Uwe Steinmann");
pdf_set_info($pdfdoc, "Creator", "Uwe Steinmann");
pdf_set_info($pdfdoc, "Title", "Testing Info Fields");
pdf_set_info($pdfdoc, "Subject", "Test");
pdf_set_info($pdfdoc, "Keywords", "Test, Fields");
pdf_set_info($pdfdoc, "CustomField", "What ever makes sense");
pdf_begin_page($pdfdoc, 595, 842);
pdf_end_page($pdfdoc);
pdf_close($pdfdoc);
?>
</programlisting></example></para>
<note><simpara>
This function replaces <function>pdf_set_info_keywords</function>,
<function>pdf_set_info_title</function>,
<function>pdf_set_info_subject</function>,
<function>pdf_set_info_creator</function>,
<function>pdf_set_info_sybject</function>.
</simpara></note>
</refsect1>
</refentry>
<refentry id="function.pdf-open">
<refnamediv>
<refname>pdf_open</refname>
<refpurpose>Opens a new pdf document</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_open</methodname>
<methodparam><type>int</type><parameter>file</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_open</function> function opens
a new pdf document. The corresponding file has to be opened
with <function>fopen</function> and the file descriptor passed
as argument <parameter>file</parameter>.
If you do not pass any parameters, the document will be created in memory
and outputed page by page either to stdout or to the web browser.
<note><simpara>
The return value is needed as the first parameter in all other
functions writing to the pdf document.
</simpara></note>
</para>
<para>
See also <function>fopen</function>,
<function>pdf_close</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-close">
<refnamediv>
<refname>pdf_close</refname>
<refpurpose>Closes a pdf document</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_close</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_close</function> function closes the pdf document.
</para>
<para>
See also <function>pdf_open</function>,
<function>fclose</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-begin-page">
<refnamediv>
<refname>pdf_begin_page</refname>
<refpurpose>Starts new page</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_begin_page</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>width</parameter></methodparam>
<methodparam><type>double</type><parameter>height</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_begin_page</function> function starts a new
page with height <parameter>height</parameter> and width
<parameter>width</parameter>. In order to create a valid
document you must call this function and
<function>pdf_end_page</function> at least once.</para>
<para>
See also <function>pdf_end_page</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-end-page">
<refnamediv>
<refname>pdf_end_page</refname>
<refpurpose>Ends a page</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_end_page</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_end_page</function> function ends a page.
Once a page is ended it cannot be modified anymore.</para>
<para>
See also <function>pdf_begin_page</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-show">
<refnamediv>
<refname>pdf_show</refname>
<refpurpose>Output text at current position</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_show</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_show</function> function outputs the
string <parameter>text</parameter> at the current text position
using the current font.</para>
<para>
See also <function>pdf_show_xy</function>,
<function>pdf_show_boxed</function>,
<function>pdf_set_text_pos</function>,
<function>pdf_set_font</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-show-boxed">
<refnamediv>
<refname>pdf_show_boxed</refname>
<refpurpose>Output text in a box</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_show_boxed</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>width</parameter></methodparam>
<methodparam><type>double</type><parameter>height</parameter></methodparam>
<methodparam><type>string</type><parameter>mode</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>feature</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_show_boxed</function> function outputs the
string <parameter>text</parameter> in a box with its lower left position
at (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
The boxes dimension is <parameter>height</parameter> by
<parameter>width</parameter>. The parameter <parameter>mode</parameter>
determines how the text is type set. If <parameter>width</parameter>
and <parameter>height</parameter> are zero, the
<parameter>mode</parameter> can be "left", "right" or "center".
If <parameter>width</parameter> or <parameter>height</parameter> is
unequal zero it can also be "justify" and "fulljustify".
</para>
<para>If the parameter <parameter>feature</parameter> is set to "blind",
the text is not shown.
</para>
<para>Returns the number of characters that could not be processed because
they did not fit into the box.
</para>
<para>
See also <function>pdf_show</function>,
<function>pdf_show_xy</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pdf-show-xy">
<refnamediv>
<refname>pdf_show_xy</refname>
<refpurpose>Output text at given position</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_show_xy</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_show_xy</function> function outputs the
string <parameter>text</parameter> at position
(<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).</para>
<para>
See also <function>pdf_show</function>,
<function>pdf_show_boxed</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-font">
<refnamediv>
<refname>pdf_set_font</refname>
<refpurpose>Selects a font face and size</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_font</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>font name</parameter></methodparam>
<methodparam><type>double</type><parameter>size</parameter></methodparam>
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>embed</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_font</function> function sets the
current font face, font size and encoding. If you use pdflib 0.6
you will need to
provide the Adobe Font Metrics (afm-files) for the font in the
font path (default is ./fonts). If you use php3 or a version of
pdflib older than 2.20 the fourth parameter
<parameter>encoding</parameter> can take the following values:
0 = builtin, 1 = pdfdoc, 2 = macroman, 3 = macexpert, 4 = winansi.
An encoding greater than 4 and less than 0 will default to winansi.
winansi is often a good choice.
If you use php4 and a version of pdflib >= 2.20 the encoding parameter
has changed to a string. Use 'winansi', 'builtin', 'host', 'macroman' etc. instead.
If the last parameter is set to
1 the font is embedded into the pdf document otherwise it is not.
To embed a font is usually a good idea if the font is not widely spread
and you cannot ensure that the person watching your document has
access on fonts in the document.
I font is only embedded once even if you call
<function>pdf_set_font</function> several times.
</para>
<note>
<simpara>
This function has to be called after
<function>pdf_begin_page</function> in order to create a valid
pdf document.
</simpara>
</note>
<note>
<simpara>
If you reference a font in a .upr file make sure the name
in the afm file and the font name are the same. Otherwise,
the font will be embedded several times (Thanks to Paul Haddon
for finding this.)
</simpara>
</note>
</refsect1>
</refentry>
<refentry id="function.pdf-set-leading">
<refnamediv>
<refname>pdf_set_leading</refname>
<refpurpose>Sets distance between text lines</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_leading</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>distance</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_leading</function> function sets the distance
between text lines. This will be used if text is output by
<function>pdf_continue_text</function>.</para>
<para>
See also <function>pdf_continue_text</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-parameter">
<refnamediv>
<refname>pdf_set_parameter</refname>
<refpurpose>Sets certain parameters</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_parameter</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_parameter</function> function sets several
parameters of pdflib which are of the type string.</para>
<para>
See also <function>pdf_get_value</function>,
<function>pdf_set_value</function>,
<function>pdf_get_parameter</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-get-parameter">
<refnamediv>
<refname>pdf_get_parameter</refname>
<refpurpose>Gets certain parameters</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pdf_get_parameter</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
<methodparam choice="opt"><type>double</type><parameter>modifier</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_get_parameter</function> function gets several
parameters of pdflib which are of the type string. The function parameter
<parameter>modifier</parameter> characterizes the parameter to get.
If the modifier is not needed it has to be 0 or not passed at all.</para>
<para>
See also <function>pdf_get_value</function>,
<function>pdf_set_value</function>,
<function>pdf_set_parameter</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-value">
<refnamediv>
<refname>pdf_set_value</refname>
<refpurpose>Sets certain numerical value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_value</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
<methodparam><type>double</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_value</function> function sets several
numerical parameters of pdflib.</para>
<para>
See also <function>pdf_get_value</function>,
<function>pdf_get_parameter</function>,
<function>pdf_set_parameter</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-get-value">
<refnamediv>
<refname>pdf_get_value</refname>
<refpurpose>Gets certain numerical value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>double</type><methodname>pdf_get_value</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
<methodparam choice="opt"><type>double</type><parameter>modifier</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_get_value</function> function gets several
numerical parameters of pdflib. The function parameter
<parameter>modifier</parameter> characterizes the parameter to get.
If the modifier is not needed it has to be 0 or not passed at all.</para>
<para>
See also <function>pdf_set_value</function>,
<function>pdf_get_parameter</function>,
<function>pdf_set_parameter</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-get-image-height">
<refnamediv>
<refname>pdf_get_image_height</refname>
<refpurpose>Returns height of an image</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pdf_get_image_height</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>image</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_get_image_height</function> function returns the
heights of a pdf image in pixel.</para>
<para>
See also <function>pdf_open_image_file</function>,
<function>pdf_open_memory_image</function>,
<function>pdf_get_image_width</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-get-image-width">
<refnamediv>
<refname>pdf_get_image_width</refname>
<refpurpose>Returns width of an image</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pdf_get_image_width</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>image</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_get_image_width</function> function returns the
widths of a pdf image in pixel.</para>
<para>
See also <function>pdf_open_image_file</function>,
<function>pdf_open_memory_image</function>,
<function>pdf_get_image_height</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-text-rendering">
<refnamediv>
<refname>pdf_set_text_rendering</refname>
<refpurpose>Determines how text is rendered</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_text_rendering</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_text_rendering</function> function determines
how text is rendered. The possible values for <parameter>mode</parameter>
are 0=fill text, 1=stroke text, 2=fill and stroke text, 3=invisible,
4=fill text and add it to cliping path, 5=stroke text and add it to
clipping path, 6=fill and stroke text and add
it to cliping path, 7=add it to clipping path.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-horiz-scaling">
<refnamediv>
<refname>pdf_set_horiz_scaling</refname>
<refpurpose>Sets horizontal scaling of text</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_horiz_scaling</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>scale</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_horiz_scaling</function> function sets the
horizontal scaling to <parameter>scale</parameter> percent.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-text-rise">
<refnamediv>
<refname>pdf_set_text_rise</refname>
<refpurpose>Sets the text rise</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_text_rise</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>rise</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_text_rise</function> function sets the
text rising to <parameter>rise</parameter> points.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-text-matrix">
<refnamediv>
<refname>pdf_set_text_matrix</refname>
<refpurpose>Sets the text matrix</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_text_matrix</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>array</type><parameter>matrix</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_text_matrix</function> function sets
a matrix which describes a transformation applied on the current
text font. The matrix has to passed as an array with six elements.</para>
<note><simpara>This function is not available anymore since pdflib 2.3
</simpara></note>
</refsect1>
</refentry>
<refentry id="function.pdf-set-text-pos">
<refnamediv>
<refname>pdf_set_text_pos</refname>
<refpurpose>Sets text position</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_text_pos</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_text_pos</function> function sets the
position of text for the next <function>pdf_show</function>
function call.</para>
<para>
See also <function>pdf_show</function>,
<function>pdf_show_xy</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-char-spacing">
<refnamediv>
<refname>pdf_set_char_spacing</refname>
<refpurpose>Sets character spacing</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_char_spacing</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>space</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_char_spacing</function> function sets the
spacing between characters.</para>
<para>
See also <function>pdf_set_word_spacing</function>,
<function>pdf_set_leading</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-word-spacing">
<refnamediv>
<refname>pdf_set_word_spacing</refname>
<refpurpose>Sets spacing between words</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_word_spacing</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>space</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_word_spacing</function> function sets the
spacing between words.</para>
<para>
See also <function>pdf_set_char_spacing</function>,
<function>pdf_set_leading</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-skew">
<refnamediv>
<refname>pdf_skew</refname>
<refpurpose>Skews the coordinate system</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_skew</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>alpha</parameter></methodparam>
<methodparam><type>double</type><parameter>beta</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_skew</function> function skew the coordinate
system by <parameter>alpha</parameter> (x) and
<parameter>beta</parameter> (y) degrees.
<parameter>alpha</parameter> and <parameter>beta</parameter> may
not be 90 or 270 degrees.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-continue-text">
<refnamediv>
<refname>pdf_continue_text</refname>
<refpurpose>Outputs text in next line</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_continue_text</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_continue_text</function> function outputs the
string in <parameter>text</parameter> in the next line.
The distance between the lines can be set with
<function>pdf_set_leading</function>.</para>
<para>
See also <function>pdf_show_xy</function>,
<function>pdf_set_leading</function>,
<function>pdf_set_text_pos</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-stringwidth">
<refnamediv>
<refname>pdf_stringwidth</refname>
<refpurpose>Returns width of text using current font</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>double</type><methodname>pdf_stringwidth</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_stringwidth</function> function returns the
width of the string in <parameter>text</parameter> by using the
current font. It requires a font to be set before with
<function>pdf_set_font</function>.</para>
<para>
See also <function>pdf_set_font</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-save">
<refnamediv>
<refname>pdf_save</refname>
<refpurpose>Saves the current environment</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_save</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_save</function> function saves the current
environment. It works like the postscript command gsave. Very
useful if you want to translate or rotate an object without effecting
other objects. <function>pdf_save</function> should always be
followed by <function>pdf_restore</function> to restore the environment
before <function>pdf_save</function>.</para>
<para>
See also <function>pdf_restore</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-restore">
<refnamediv>
<refname>pdf_restore</refname>
<refpurpose>Restores formerly saved environment</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_restore</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_restore</function> function restores the
environment saved with <function>pdf_save</function>. It works
like the postscript command grestore.
<example>
<title>Save and Restore</title>
<programlisting>
<?php pdf_save($pdf);
// do all kinds of rotations, transformations, ...
pdf_restore($pdf) ?>
</programlisting></example></para>
<para>
See also <function>pdf_save</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-translate">
<refnamediv>
<refname>pdf_translate</refname>
<refpurpose>Sets origin of coordinate system</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_translate</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_translate</function> function sets the origin of
coordinate system to the point (<parameter>x-coor</parameter>,
<parameter>y-coor</parameter>) relativ the current origin.
The following example draws
a line from (0, 0) to (200, 200) relative to the initial coordinate
system. You have to set the current point after
<function>pdf_translate</function> and before you start drawing
more objects.
<example>
<title>Translation</title>
<programlisting>
<?php pdf_moveto($pdf, 0, 0);
pdf_lineto($pdf, 100, 100);
pdf_stroke($pdf);
pdf_translate($pdf, 100, 100);
pdf_moveto($pdf, 0, 0);
pdf_lineto($pdf, 100, 100);
pdf_stroke($pdf);
?>
</programlisting></example></para>
</refsect1>
</refentry>
<refentry id="function.pdf-scale">
<refnamediv>
<refname>pdf_scale</refname>
<refpurpose>Sets scaling</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_scale</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-scale</parameter></methodparam>
<methodparam><type>double</type><parameter>y-scale</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_scale</function> function sets the scaling factor
in both directions. The following example scales x and y direction
by 72. The following line will therefore be drawn one inch in both
directions.
<example>
<title>Scaling</title>
<programlisting>
<?php pdf_scale($pdf, 72.0, 72.0);
pdf_lineto($pdf, 1, 1);
pdf_stroke($pdf);
?>
</programlisting></example></para>
</refsect1>
</refentry>
<refentry id="function.pdf-rotate">
<refnamediv>
<refname>pdf_rotate</refname>
<refpurpose>Sets rotation</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_rotate</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>angle</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_rotate</function> function sets the rotation in
degress to <parameter>angle</parameter>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setflat">
<refnamediv>
<refname>pdf_setflat</refname>
<refpurpose>Sets flatness</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setflat</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setflat</function> function sets the flatness to
a value between 0 and 100.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setlinejoin">
<refnamediv>
<refname>pdf_setlinejoin</refname>
<refpurpose>Sets linejoin parameter</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setlinejoin</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>long</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setlinejoin</function> function sets the linejoin
parameter between a value of 0 and 2.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setlinecap">
<refnamediv>
<refname>pdf_setlinecap</refname>
<refpurpose>Sets linecap parameter</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setlinecap</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setlinecap</function> function sets the linecap
parameter between a value of 0 and 2.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setmiterlimit">
<refnamediv>
<refname>pdf_setmiterlimit</refname>
<refpurpose>Sets miter limit</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setmiterlimit</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setmiterlimit</function> function sets the miter limit
to a value greater of equal than 1.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setlinewidth">
<refnamediv>
<refname>pdf_setlinewidth</refname>
<refpurpose>Sets line width</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setlinewidth</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>width</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setlinewidth</function> function sets the line width
to <parameter>width</parameter>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setdash">
<refnamediv>
<refname>pdf_setdash</refname>
<refpurpose>Sets dash pattern</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setdash</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>white</parameter></methodparam>
<methodparam><type>double</type><parameter>black</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setdash</function> function sets the dash pattern
<parameter>white</parameter> white points and <parameter>black</parameter>
black points. If both are 0 a solid line is set.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-moveto">
<refnamediv>
<refname>pdf_moveto</refname>
<refpurpose>Sets current point</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_moveto</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_moveto</function> function sets the current point
to the coordinates <parameter>x-coor</parameter> and
<parameter>y-coor</parameter>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-curveto">
<refnamediv>
<refname>pdf_curveto</refname>
<refpurpose>Draws a curve</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_curveto</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x1</parameter></methodparam>
<methodparam><type>double</type><parameter>y1</parameter></methodparam>
<methodparam><type>double</type><parameter>x2</parameter></methodparam>
<methodparam><type>double</type><parameter>y2</parameter></methodparam>
<methodparam><type>double</type><parameter>x3</parameter></methodparam>
<methodparam><type>double</type><parameter>y3</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_curveto</function> function draws a Bezier curve
from the current point to the point
(<parameter>x3</parameter>, <parameter>y3</parameter>) using
(<parameter>x1</parameter>, <parameter>y1</parameter>) and
(<parameter>x2</parameter>, <parameter>y2</parameter>) as control
points.</para>
<para>
See also <function>pdf_moveto</function>,
<function>pdf_lineto</function>,
<function>pdf_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-lineto">
<refnamediv>
<refname>pdf_lineto</refname>
<refpurpose>Draws a line</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_lineto</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_lineto</function> function draws a line from
the current point to the point with coordinates
(<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).</para>
<para>
See also <function>pdf_moveto</function>,
<function>pdf_curveto</function>,
<function>pdf_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-circle">
<refnamediv>
<refname>pdf_circle</refname>
<refpurpose>Draws a circle</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_circle</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>radius</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_circle</function> function draws a circle with
center at point
(<parameter>x-coor</parameter>, <parameter>y-coor</parameter>)
and radius <parameter>radius</parameter>.</para>
<para>
See also <function>pdf_arc</function>,
<function>pdf_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-arc">
<refnamediv>
<refname>pdf_arc</refname>
<refpurpose>Draws an arc</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_arc</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>radius</parameter></methodparam>
<methodparam><type>double</type><parameter>start</parameter></methodparam>
<methodparam><type>double</type><parameter>end</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_arc</function> function draws an arc with
center at point
(<parameter>x-coor</parameter>, <parameter>y-coor</parameter>)
and radius <parameter>radius</parameter>, starting at angle
<parameter>start</parameter> and ending at angle
<parameter>end</parameter>.</para>
<para>
See also <function>pdf_circle</function>,
<function>pdf_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-rect">
<refnamediv>
<refname>pdf_rect</refname>
<refpurpose>Draws a rectangle</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_rect</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>width</parameter></methodparam>
<methodparam><type>double</type><parameter>height</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_rect</function> function draws a rectangle with
its lower left corner at point
(<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
This width is set to <parameter>width</parameter>.
This height is set to <parameter>height</parameter>.</para>
<para>
See also <function>pdf_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-closepath">
<refnamediv>
<refname>pdf_closepath</refname>
<refpurpose>Closes path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_closepath</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_closepath</function> function closes the
current path. This means, it draws a line from current point to
the point where the first line was started. Many functions like
<function>pdf_moveto</function>, <function>pdf_circle</function>
and <function>pdf_rect</function> start a new path.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-stroke">
<refnamediv>
<refname>pdf_stroke</refname>
<refpurpose>Draws line along path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_stroke</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_stroke</function> function draws a line along
current path. The current path is the sum of all line drawing.
Without this function the line would not be drawn.</para>
<para>
See also <function>pdf_closepath</function>,
<function>pdf_closepath_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-closepath-stroke">
<refnamediv>
<refname>pdf_closepath_stroke</refname>
<refpurpose>Closes path and draws line along path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_closepath_stroke</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_closepath_stroke</function> function is a
combination of <function>pdf_closepath</function> and
<function>pdf_stroke</function>. It also clears the path.</para>
<para>
See also <function>pdf_closepath</function>,
<function>pdf_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-fill">
<refnamediv>
<refname>pdf_fill</refname>
<refpurpose>Fills current path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_fill</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_fill</function> function fills the interior of
the current path with the current fill color.</para>
<para>
See also <function>pdf_closepath</function>,
<function>pdf_stroke</function>,
<function>pdf_setgray_fill</function>,
<function>pdf_setgray</function>,
<function>pdf_setrgbcolor_fill</function>,
<function>pdf_setrgbcolor</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-fill-stroke">
<refnamediv>
<refname>pdf_fill_stroke</refname>
<refpurpose>Fills and strokes current path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_fill_stroke</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_fill_stroke</function> function fills the interior of
the current path with the current fill color and draws current path.</para>
<para>
See also <function>pdf_closepath</function>,
<function>pdf_stroke</function>,
<function>pdf_fill</function>,
<function>pdf_setgray_fill</function>,
<function>pdf_setgray</function>,
<function>pdf_setrgbcolor_fill</function>,
<function>pdf_setrgbcolor</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-closepath-fill-stroke">
<refnamediv>
<refname>pdf_closepath_fill_stroke</refname>
<refpurpose>Closes, fills and strokes current path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_closepath_fill_stroke</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_closepath_fill_stroke</function> function closes,
fills the interior of
the current path with the current fill color and draws current path.</para>
<para>
See also <function>pdf_closepath</function>,
<function>pdf_stroke</function>,
<function>pdf_fill</function>,
<function>pdf_setgray_fill</function>,
<function>pdf_setgray</function>,
<function>pdf_setrgbcolor_fill</function>,
<function>pdf_setrgbcolor</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-endpath">
<refnamediv>
<refname>pdf_endpath</refname>
<refpurpose>Ends current path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_endpath</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_endpath</function> function ends
the current path but does not close it.</para>
<para>
See also <function>pdf_closepath</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-clip">
<refnamediv>
<refname>pdf_clip</refname>
<refpurpose>Clips to current path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_clip</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_clip</function> function clips all drawing
to the current path.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setgray-fill">
<refnamediv>
<refname>pdf_setgray_fill</refname>
<refpurpose>Sets filling color to gray value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setgray_fill</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>gray value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setgray_fill</function> function sets the current
gray value to fill a path.</para>
<para>
See also <function>pdf_setrgbcolor_fill</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setgray-stroke">
<refnamediv>
<refname>pdf_setgray_stroke</refname>
<refpurpose>Sets drawing color to gray value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setgray_stroke</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>gray value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setgray_stroke</function> function sets the current
drawing color to the given gray value.</para>
<para>
See also <function>pdf_setrgbcolor_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setgray">
<refnamediv>
<refname>pdf_setgray</refname>
<refpurpose>Sets drawing and filling color to gray value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setgray</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>gray value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setgray</function> function sets the current
drawing and filling color to the given gray value.</para>
<para>
See also <function>pdf_setrgbcolor_stroke</function>,
<function>pdf_setrgbcolor_fill</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setrgbcolor-fill">
<refnamediv>
<refname>pdf_setrgbcolor_fill</refname>
<refpurpose>Sets filling color to rgb color value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setrgbcolor_fill</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>red value</parameter></methodparam>
<methodparam><type>double</type><parameter>green value</parameter></methodparam>
<methodparam><type>double</type><parameter>blue value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setrgbcolor_fill</function> function sets the current
rgb color value to fill a path.</para>
<para>
See also <function>pdf_setrgbcolor_fill</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setrgbcolor-stroke">
<refnamediv>
<refname>pdf_setrgbcolor_stroke</refname>
<refpurpose>Sets drawing color to rgb color value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setrgbcolor_stroke</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>red value</parameter></methodparam>
<methodparam><type>double</type><parameter>green value</parameter></methodparam>
<methodparam><type>double</type><parameter>blue value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setrgbcolor_stroke</function> function sets the current
drawing color to the given rgb color value.</para>
<para>
See also <function>pdf_setrgbcolor_stroke</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-setrgbcolor">
<refnamediv>
<refname>pdf_setrgbcolor</refname>
<refpurpose>Sets drawing and filling color to rgb color value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_setrgbcolor</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>red value</parameter></methodparam>
<methodparam><type>double</type><parameter>green value</parameter></methodparam>
<methodparam><type>double</type><parameter>blue value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_setrgbcolor_stroke</function> function sets the current
drawing and filling color to the given rgb color value.</para>
<para>
See also <function>pdf_setrgbcolor_stroke</function>,
<function>pdf_setrgbcolor_fill</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-add-outline">
<refnamediv>
<refname>pdf_add_outline</refname>
<refpurpose>Adds bookmark for current page</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_add_outline</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>parent</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>open</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_add_outline</function> function adds a bookmark
with text <parameter>text</parameter> that points to the current page.
The bookmark is inserted as a child of <parameter>parent</parameter> and
is by default open if <parameter>open</parameter> is not 0. The
return value is an identifier for the bookmark which can be used
as a parent for other bookmarks. Therefore you can build up hierarchies
of bookmarks.
</para>
<simpara>
Unfortunately pdflib does not make a copy of the string, which forces
PHP to allocate the memory. Currently this piece of memory is not
been freed by any PDF function but it will be taken care of by the
PHP memory manager.</simpara>
</refsect1>
</refentry>
<refentry id="function.pdf-set-transition">
<refnamediv>
<refname>pdf_set_transition</refname>
<refpurpose>Sets transition between pages</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_transition</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>transition</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_transition</function> function set the transition
between following pages. The value of <parameter>transition</parameter>
can be
<simplelist>
<member>
0 for none,
</member>
<member>
1 for two lines sweeping across the screen reveal the page,
</member>
<member>
2 for multiple lines sweeping across the screen reveal the page,
</member>
<member>
3 for a box reveals the page,
</member>
<member>
4 for a single line sweeping across the screen reveals the page,
</member>
<member>
5 for the old page dissolves to reveal the page,
</member>
<member>
6 for the dissolve effect moves from one screen edge to another,
</member>
<member>
7 for the old page is simply replaced by the new page (default)
</member>
</simplelist></para>
<para>
See also <function>pdf_set_duration</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-duration">
<refnamediv>
<refname>pdf_set_duration</refname>
<refpurpose>Sets duration between pages</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_duration</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>duration</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_duration</function> function set the duration
between following pages in seconds.</para>
<para>
See also <function>pdf_set_transition</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-open-gif">
<refnamediv>
<refname>pdf_open_gif</refname>
<refpurpose>Opens a GIF image</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_open_gif</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_open_gif</function> function opens an image stored
in the file with the name <parameter>filename</parameter>.
The format of the image has to be gif. The function returns a pdf
image identifier.
<note><simpara>This function shouldn't be used anymore. Please use
the function <function>pdf_open_image_file</function> instead.
</simpara></note>
<example>
<title>Including a gif image</title>
<programlisting>
<?php
$im = pdf_open_gif($pdf, "test.gif");
pdf_place_image($pdf, $im, 100, 100, 1);
pdf_close_image($pdf, $im);
?>
</programlisting>
</example></para>
<para>
See also <function>pdf_close_image</function>,
<function>pdf_open_jpeg</function>,
<function>pdf_open_memory_image</function>,
<function>pdf_execute_image</function>,
<function>pdf_place_image</function>,
<function>pdf_put_image</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-open-png">
<refnamediv>
<refname>pdf_open_png</refname>
<refpurpose>
Opens a PNG image
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_open_png</methodname>
<methodparam><type>int</type><parameter>pdf</parameter></methodparam>
<methodparam><type>string</type><parameter>png_file</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_open_png</function> function opens an image stored
in the file with the name <parameter>filename</parameter>.
The format of the image has to be png. The function returns a pdf
image identifier.
<note><simpara>This function shouldn't be used anymore. Please use
the function <function>pdf_open_image_file</function> instead.
</simpara></note>
<example>
<title>Including a PNG image</title>
<programlisting>
<?php
$im = pdf_open_png ($pdf, "test.png");
pdf_place_image ($pdf, $im, 100, 100, 1);
pdf_close_image ($pdf, $im);
?>
</programlisting>
</example>
</para>
<para>
See also <function>pdf_close_image</function>,
<function>pdf_open_jpeg</function>,
<function>pdf_open_gif</function>,
<function>pdf_open_memory_image</function>,
<function>pdf_execute_image</function>,
<function>pdf_place_image</function>,
<function>pdf_put_image</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pdf-open-image-file">
<refnamediv>
<refname>pdf_open_image_file</refname>
<refpurpose>Reads an image from a file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_open_image_file</methodname>
<methodparam><type>int</type><parameter>PDF-document</parameter></methodparam>
<methodparam><type>string</type><parameter>format</parameter></methodparam>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
The function <function>pdf_open_image_file</function> reads an image
of format <parameter>format</parameter> from the file
<parameter>filename</parameter>.
Possible formats are 'png', 'tiff', 'jpeg' and 'gif'.
The function returns a pdf image identifier.
<example>
<title>Inserting an image</title>
<programlisting>
<?php
$pim = pdf_open_image_file($pdf, "png", "picture.png");
pdf_place_image($pdf, $pim, 100, 100, 1);
pdf_close_image($pdf, $pim);
?>
</programlisting>
</example></para>
<para>
See also <function>pdf_close_image</function>,
<function>pdf_open_jpeg</function>,
<function>pdf_open_gif</function>,
<function>pdf_open_tiff</function>,
<function>pdf_open_png</function>,
<function>pdf_execute_image</function>,
<function>pdf_place_image</function>,
<function>pdf_put_image</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-open-memory-image">
<refnamediv>
<refname>pdf_open_memory_image</refname>
<refpurpose>Opens an image created with PHP's image functions</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_open_memory_image</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>image</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_open_memory_image</function> function takes
an image created with the PHP's image functions and makes it available
for the pdf document. The function returns a pdf
image identifier.
<example>
<title>Including a memory image</title>
<programlisting>
<?php
$im = ImageCreate(100, 100);
$col = ImageColorAllocate($im, 80, 45, 190);
ImageFill($im, 10, 10, $col);
$pim = pdf_open_memory_image($pdf, $im);
ImageDestroy($im);
pdf_place_image($pdf, $pim, 100, 100, 1);
pdf_close_image($pdf, $pim);
?>
</programlisting>
</example></para>
<para>
See also <function>pdf_close_image</function>,
<function>pdf_open_jpeg</function>,
<function>pdf_open_gif</function>,
<function>pdf_open_png</function>
<function>pdf_execute_image</function>,
<function>pdf_place_image</function>,
<function>pdf_put_image</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-open-jpeg">
<refnamediv>
<refname>pdf_open_jpeg</refname>
<refpurpose>Opens a JPEG image</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_open_jpeg</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_open_jpeg</function> function opens an image stored
in the file with the name <parameter>filename</parameter>.
The format of the image has to be jpeg. The function returns a pdf
image identifier.
<note><simpara>This function shouldn't be used anymore. Please use
the function <function>pdf_open_image_file</function> instead.
</simpara></note></para>
<para>
See also <function>pdf_close_image</function>,
<function>pdf_open_gif</function>,
<function>pdf_open_png</function>,
<function>pdf_open_memory_image</function>,
<function>pdf_execute_image</function>,
<function>pdf_place_image</function>,
<function>pdf_put_image</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-open-tiff">
<refnamediv>
<refname>pdf_open_tiff</refname>
<refpurpose>Opens a TIFF image</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pdf_open_tiff</methodname>
<methodparam><type>int</type><parameter>PDF-document</parameter></methodparam>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_open_tiff</function> function opens an image stored
in the file with the name <parameter>filename</parameter>.
The format of the image has to be tiff. The function returns a pdf
image identifier.
<note><simpara>This function shouldn't be used anymore. Please use
the function <function>pdf_open_image_file</function> instead.
</simpara></note>
</para>
<para>
See also <function>pdf_close_image</function>,
<function>pdf_open_gif</function>,
<function>pdf_open_jpeg</function>,
<function>pdf_open_png</function>,
<function>pdf_open_memory_image</function>,
<function>pdf_execute_image</function>,
<function>pdf_place_image</function>,
<function>pdf_put_image</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pdf-close-image">
<refnamediv>
<refname>pdf_close_image</refname>
<refpurpose>Closes an image</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_close_image</methodname>
<methodparam><type>int</type><parameter>image</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_close_image</function> function closes an image
which has been opened with any of the <function>pdf_open_xxx</function>
functions.</para>
<para>
See also <function>pdf_open_jpeg</function>,
<function>pdf_open_gif</function>,
<function>pdf_open_memory_image</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-place-image">
<refnamediv>
<refname>pdf_place_image</refname>
<refpurpose>Places an image on the page</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_place_image</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>image</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>scale</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_place_image</function> function places an image
on the page at postion (<parameter>x-coor</parameter>,
<parameter>x-coor</parameter>). The image can be scaled at the same
time.
</para>
<para>
See also <function>pdf_put_image</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pdf-put-image">
<refnamediv>
<refname>pdf_put_image</refname>
<refpurpose>Stores an image in the PDF for later use</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_put_image</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>image</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_put_image</function> function places an image
in the PDF file without showing it. The stored image can be
displayed with the <function>pdf_execute_image</function>
function as many times as needed. This is useful when using the same
image multiple times in order to keep the file size small. Using
<function>pdf_put_image</function> and
<function>pdf_execute_image</function> is highly recommended for
larger images (several kb) if they show up more than once in the
document.
<note><simpara>This function has become meaningless with version
2.01 of pdflib. It will just output a warning.</simpara>
</note></para>
<para>
See also <function>pdf_put_image</function>,
<function>pdf_place_image</function>,
<function>pdf_execute_image</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-execute-image">
<refnamediv>
<refname>pdf_execute_image</refname>
<refpurpose>Places a stored image on the page</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_execute_image</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>int</type><parameter>image</parameter></methodparam>
<methodparam><type>double</type><parameter>x-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>y-coor</parameter></methodparam>
<methodparam><type>double</type><parameter>scale</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_execute_image</function> function displays an image that has been
put in the PDF file with the <function>pdf_put_image</function>
function on the current page at the given coordinates.</para>
<para>
The image can be scaled while displaying it. A scale of 1.0
will show the image in the original size.
<note><simpara>This function has become meaningless with version
2.01 of pdflib. It will just output a warning.</simpara>
</note>
<example>
<title>Multiple show of an image</title>
<programlisting>
<?php
$im = ImageCreate(100, 100);
$col1 = ImageColorAllocate($im, 80, 45, 190);
ImageFill($im, 10, 10, $col1);
$pim = pdf_open_memory_image($pdf, $im);
pdf_put_image($pdf, $pim);
pdf_execute_image($pdf, $pim, 100, 100, 1);
pdf_execute_image($pdf, $pim, 200, 200, 2);
pdf_close_image($pdf, $pim);
?>
</programlisting>
</example></para>
</refsect1>
</refentry>
<refentry id="function.pdf-add-annotation">
<refnamediv>
<refname>pdf_add_annotation</refname>
<refpurpose>Adds annotation</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_add_annotation</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>llx</parameter></methodparam>
<methodparam><type>double</type><parameter>lly</parameter></methodparam>
<methodparam><type>double</type><parameter>urx</parameter></methodparam>
<methodparam><type>double</type><parameter>ury</parameter></methodparam>
<methodparam><type>string</type><parameter>title</parameter></methodparam>
<methodparam><type>string</type><parameter>content</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_add_annotation</function> adds a note with
the lower left corner at (<parameter>llx</parameter>,
<parameter>lly</parameter>) and the upper right corner at
(<parameter>urx</parameter>, <parameter>ury</parameter>).</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-border-style">
<refnamediv>
<refname>pdf_set_border_style</refname>
<refpurpose>Sets style of border around links and annotations</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_border_style</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>string</type><parameter>style</parameter></methodparam>
<methodparam><type>double</type><parameter>width</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_border_style</function> function sets the
style and width of the suroundig box of links and annotations.
The parameter <parameter>style</parameter> can be 'solid' or
'dashed'.</para>
<para>
See also <function>pdf_set_border_color</function>,
<function>pdf_set_border_dash</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-border-color">
<refnamediv>
<refname>pdf_set_border_color</refname>
<refpurpose>Sets color of border around links and annotations</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_border_color</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>red</parameter></methodparam>
<methodparam><type>double</type><parameter>green</parameter></methodparam>
<methodparam><type>double</type><parameter>blue</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_border_color</function> function sets the
color of the suroundig box of links and annotations.
The three color components have to have a value between 0.0 and
1.0.</para>
<para>
See also <function>pdf_set_border_style</function>,
<function>pdf_set_border_dash</function>.</para>
</refsect1>
</refentry>
<refentry id="function.pdf-set-border-dash">
<refnamediv>
<refname>pdf_set_border_dash</refname>
<refpurpose>Sets dash style of border around links and annotations</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>pdf_set_border_dash</methodname>
<methodparam><type>int</type><parameter>pdf document</parameter></methodparam>
<methodparam><type>double</type><parameter>black</parameter></methodparam>
<methodparam><type>double</type><parameter>white</parameter></methodparam>
</methodsynopsis>
<para>
The <function>pdf_set_border_dash</function> function sets the
lenght of
black and white areas of a dashed line of the suroundig box of
links and annotations.</para>
<para>
See also <function>pdf_set_border_style</function>,
<function>pdf_set_border_color</function>.</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
|