1<?php 2 3namespace Safe; 4 5use Safe\Exceptions\PdfException; 6 7/** 8 * Activates a previously created structure element or other content item. 9 * Returns TRUE on success. 10 * 11 * @param resource $pdfdoc 12 * @param int $id 13 * @throws PdfException 14 * 15 */ 16function PDF_activate_item($pdfdoc, int $id): void 17{ 18 error_clear_last(); 19 $result = \PDF_activate_item($pdfdoc, $id); 20 if ($result === false) { 21 throw PdfException::createFromPhpError(); 22 } 23} 24 25 26/** 27 * Add a link annotation to a target within the current PDF file. 28 * Returns TRUE on success. 29 * 30 * This function is deprecated since PDFlib version 6, use 31 * PDF_create_action with type=GoTo 32 * and PDF_create_annotation with 33 * type=Link instead. 34 * 35 * @param resource $pdfdoc 36 * @param float $lowerleftx 37 * @param float $lowerlefty 38 * @param float $upperrightx 39 * @param float $upperrighty 40 * @param int $page 41 * @param string $dest 42 * @throws PdfException 43 * 44 */ 45function PDF_add_locallink($pdfdoc, float $lowerleftx, float $lowerlefty, float $upperrightx, float $upperrighty, int $page, string $dest): void 46{ 47 error_clear_last(); 48 $result = \PDF_add_locallink($pdfdoc, $lowerleftx, $lowerlefty, $upperrightx, $upperrighty, $page, $dest); 49 if ($result === false) { 50 throw PdfException::createFromPhpError(); 51 } 52} 53 54 55/** 56 * Creates a named destination on an arbitrary page in the current document. 57 * Returns TRUE on success. 58 * 59 * @param resource $pdfdoc 60 * @param string $name 61 * @param string $optlist 62 * @throws PdfException 63 * 64 */ 65function PDF_add_nameddest($pdfdoc, string $name, string $optlist): void 66{ 67 error_clear_last(); 68 $result = \PDF_add_nameddest($pdfdoc, $name, $optlist); 69 if ($result === false) { 70 throw PdfException::createFromPhpError(); 71 } 72} 73 74 75/** 76 * Sets an annotation for the current page. Returns TRUE on success. 77 * 78 * This function is deprecated since PDFlib version 6, use 79 * PDF_create_annotation with 80 * type=Text instead. 81 * 82 * @param resource $pdfdoc 83 * @param float $llx 84 * @param float $lly 85 * @param float $urx 86 * @param float $ury 87 * @param string $contents 88 * @param string $title 89 * @param string $icon 90 * @param int $open 91 * @throws PdfException 92 * 93 */ 94function PDF_add_note($pdfdoc, float $llx, float $lly, float $urx, float $ury, string $contents, string $title, string $icon, int $open): void 95{ 96 error_clear_last(); 97 $result = \PDF_add_note($pdfdoc, $llx, $lly, $urx, $ury, $contents, $title, $icon, $open); 98 if ($result === false) { 99 throw PdfException::createFromPhpError(); 100 } 101} 102 103 104/** 105 * Add a file link annotation to a PDF target. 106 * Returns TRUE on success. 107 * 108 * This function is deprecated since PDFlib version 6, use 109 * PDF_create_action with 110 * type=GoToR and 111 * PDF_create_annotation with 112 * type=Link instead. 113 * 114 * @param resource $pdfdoc 115 * @param float $bottom_left_x 116 * @param float $bottom_left_y 117 * @param float $up_right_x 118 * @param float $up_right_y 119 * @param string $filename 120 * @param int $page 121 * @param string $dest 122 * @throws PdfException 123 * 124 */ 125function PDF_add_pdflink($pdfdoc, float $bottom_left_x, float $bottom_left_y, float $up_right_x, float $up_right_y, string $filename, int $page, string $dest): void 126{ 127 error_clear_last(); 128 $result = \PDF_add_pdflink($pdfdoc, $bottom_left_x, $bottom_left_y, $up_right_x, $up_right_y, $filename, $page, $dest); 129 if ($result === false) { 130 throw PdfException::createFromPhpError(); 131 } 132} 133 134 135/** 136 * Adds an existing image as thumbnail for the current page. 137 * Returns TRUE on success. 138 * 139 * @param resource $pdfdoc 140 * @param int $image 141 * @throws PdfException 142 * 143 */ 144function PDF_add_thumbnail($pdfdoc, int $image): void 145{ 146 error_clear_last(); 147 $result = \PDF_add_thumbnail($pdfdoc, $image); 148 if ($result === false) { 149 throw PdfException::createFromPhpError(); 150 } 151} 152 153 154/** 155 * Adds a weblink annotation to a target url on the Web. 156 * Returns TRUE on success. 157 * 158 * This function is deprecated since PDFlib version 6, use 159 * PDF_create_action with type=URI 160 * and PDF_create_annotation with 161 * type=Link instead. 162 * 163 * @param resource $pdfdoc 164 * @param float $lowerleftx 165 * @param float $lowerlefty 166 * @param float $upperrightx 167 * @param float $upperrighty 168 * @param string $url 169 * @throws PdfException 170 * 171 */ 172function PDF_add_weblink($pdfdoc, float $lowerleftx, float $lowerlefty, float $upperrightx, float $upperrighty, string $url): void 173{ 174 error_clear_last(); 175 $result = \PDF_add_weblink($pdfdoc, $lowerleftx, $lowerlefty, $upperrightx, $upperrighty, $url); 176 if ($result === false) { 177 throw PdfException::createFromPhpError(); 178 } 179} 180 181 182/** 183 * Adds a file attachment annotation. Returns TRUE on success. 184 * 185 * This function is deprecated since PDFlib version 6, use 186 * PDF_create_annotation with 187 * type=FileAttachment instead. 188 * 189 * @param resource $pdfdoc 190 * @param float $llx 191 * @param float $lly 192 * @param float $urx 193 * @param float $ury 194 * @param string $filename 195 * @param string $description 196 * @param string $author 197 * @param string $mimetype 198 * @param string $icon 199 * @throws PdfException 200 * 201 */ 202function PDF_attach_file($pdfdoc, float $llx, float $lly, float $urx, float $ury, string $filename, string $description, string $author, string $mimetype, string $icon): void 203{ 204 error_clear_last(); 205 $result = \PDF_attach_file($pdfdoc, $llx, $lly, $urx, $ury, $filename, $description, $author, $mimetype, $icon); 206 if ($result === false) { 207 throw PdfException::createFromPhpError(); 208 } 209} 210 211 212/** 213 * Starts a layer for subsequent output on the page. Returns TRUE on success. 214 * 215 * This function requires PDF 1.5. 216 * 217 * @param resource $pdfdoc 218 * @param int $layer 219 * @throws PdfException 220 * 221 */ 222function PDF_begin_layer($pdfdoc, int $layer): void 223{ 224 error_clear_last(); 225 $result = \PDF_begin_layer($pdfdoc, $layer); 226 if ($result === false) { 227 throw PdfException::createFromPhpError(); 228 } 229} 230 231 232/** 233 * Adds a new page to the document, and specifies various options. 234 * The parameters width and height 235 * are the dimensions of the new page in points. Returns TRUE on success. 236 * 237 * 238 * Common Page Sizes in Points 239 * 240 * 241 * 242 * name 243 * size 244 * 245 * 246 * 247 * 248 * A0 249 * 2380 x 3368 250 * 251 * 252 * A1 253 * 1684 x 2380 254 * 255 * 256 * A2 257 * 1190 x 1684 258 * 259 * 260 * A3 261 * 842 x 1190 262 * 263 * 264 * A4 265 * 595 x 842 266 * 267 * 268 * A5 269 * 421 x 595 270 * 271 * 272 * A6 273 * 297 x 421 274 * 275 * 276 * B5 277 * 501 x 709 278 * 279 * 280 * letter (8.5" x 11") 281 * 612 x 792 282 * 283 * 284 * legal (8.5" x 14") 285 * 612 x 1008 286 * 287 * 288 * ledger (17" x 11") 289 * 1224 x 792 290 * 291 * 292 * 11" x 17" 293 * 792 x 1224 294 * 295 * 296 * 297 * 298 * 299 * @param resource $pdfdoc 300 * @param float $width 301 * @param float $height 302 * @param string $optlist 303 * @throws PdfException 304 * 305 */ 306function PDF_begin_page_ext($pdfdoc, float $width, float $height, string $optlist): void 307{ 308 error_clear_last(); 309 $result = \PDF_begin_page_ext($pdfdoc, $width, $height, $optlist); 310 if ($result === false) { 311 throw PdfException::createFromPhpError(); 312 } 313} 314 315 316/** 317 * Adds a new page to the document. Returns TRUE on success. 318 * 319 * This function is deprecated since PDFlib version 6, use 320 * PDF_begin_page_ext instead. 321 * 322 * @param resource $pdfdoc 323 * @param float $width 324 * @param float $height 325 * @throws PdfException 326 * 327 */ 328function PDF_begin_page($pdfdoc, float $width, float $height): void 329{ 330 error_clear_last(); 331 $result = \PDF_begin_page($pdfdoc, $width, $height); 332 if ($result === false) { 333 throw PdfException::createFromPhpError(); 334 } 335} 336 337 338/** 339 * Adds a circle. Returns TRUE on success. 340 * 341 * @param resource $pdfdoc 342 * @param float $x 343 * @param float $y 344 * @param float $r 345 * @throws PdfException 346 * 347 */ 348function PDF_circle($pdfdoc, float $x, float $y, float $r): void 349{ 350 error_clear_last(); 351 $result = \PDF_circle($pdfdoc, $x, $y, $r); 352 if ($result === false) { 353 throw PdfException::createFromPhpError(); 354 } 355} 356 357 358/** 359 * Uses the current path as clipping path, and terminate the path. Returns TRUE on success. 360 * 361 * @param resource $p 362 * @throws PdfException 363 * 364 */ 365function PDF_clip($p): void 366{ 367 error_clear_last(); 368 $result = \PDF_clip($p); 369 if ($result === false) { 370 throw PdfException::createFromPhpError(); 371 } 372} 373 374 375/** 376 * Closes the page handle, and frees all page-related resources. Returns TRUE on success. 377 * 378 * @param resource $p 379 * @param int $page 380 * @throws PdfException 381 * 382 */ 383function PDF_close_pdi_page($p, int $page): void 384{ 385 error_clear_last(); 386 $result = \PDF_close_pdi_page($p, $page); 387 if ($result === false) { 388 throw PdfException::createFromPhpError(); 389 } 390} 391 392 393/** 394 * Closes all open page handles, and closes the input PDF document. Returns TRUE on success. 395 * 396 * This function is deprecated since PDFlib version 7, 397 * use PDF_close_pdi_document instead. 398 * 399 * @param resource $p 400 * @param int $doc 401 * @throws PdfException 402 * 403 */ 404function PDF_close_pdi($p, int $doc): void 405{ 406 error_clear_last(); 407 $result = \PDF_close_pdi($p, $doc); 408 if ($result === false) { 409 throw PdfException::createFromPhpError(); 410 } 411} 412 413 414/** 415 * Closes the generated PDF file, and frees all document-related resources. 416 * Returns TRUE on success. 417 * 418 * This function is deprecated since PDFlib version 6, use 419 * PDF_end_document instead. 420 * 421 * @param resource $p 422 * @throws PdfException 423 * 424 */ 425function PDF_close($p): void 426{ 427 error_clear_last(); 428 $result = \PDF_close($p); 429 if ($result === false) { 430 throw PdfException::createFromPhpError(); 431 } 432} 433 434 435/** 436 * Closes the path, fills, and strokes it. Returns TRUE on success. 437 * 438 * @param resource $p 439 * @throws PdfException 440 * 441 */ 442function PDF_closepath_fill_stroke($p): void 443{ 444 error_clear_last(); 445 $result = \PDF_closepath_fill_stroke($p); 446 if ($result === false) { 447 throw PdfException::createFromPhpError(); 448 } 449} 450 451 452/** 453 * Closes the path, and strokes it. Returns TRUE on success. 454 * 455 * @param resource $p 456 * @throws PdfException 457 * 458 */ 459function PDF_closepath_stroke($p): void 460{ 461 error_clear_last(); 462 $result = \PDF_closepath_stroke($p); 463 if ($result === false) { 464 throw PdfException::createFromPhpError(); 465 } 466} 467 468 469/** 470 * Closes the current path. Returns TRUE on success. 471 * 472 * @param resource $p 473 * @throws PdfException 474 * 475 */ 476function PDF_closepath($p): void 477{ 478 error_clear_last(); 479 $result = \PDF_closepath($p); 480 if ($result === false) { 481 throw PdfException::createFromPhpError(); 482 } 483} 484 485 486/** 487 * Concatenates a matrix to the current transformation matrix (CTM). Returns TRUE on success. 488 * 489 * @param resource $p 490 * @param float $a 491 * @param float $b 492 * @param float $c 493 * @param float $d 494 * @param float $e 495 * @param float $f 496 * @throws PdfException 497 * 498 */ 499function PDF_concat($p, float $a, float $b, float $c, float $d, float $e, float $f): void 500{ 501 error_clear_last(); 502 $result = \PDF_concat($p, $a, $b, $c, $d, $e, $f); 503 if ($result === false) { 504 throw PdfException::createFromPhpError(); 505 } 506} 507 508 509/** 510 * Prints text at the next line. Returns TRUE on success. 511 * 512 * @param resource $p 513 * @param string $text 514 * @throws PdfException 515 * 516 */ 517function PDF_continue_text($p, string $text): void 518{ 519 error_clear_last(); 520 $result = \PDF_continue_text($p, $text); 521 if ($result === false) { 522 throw PdfException::createFromPhpError(); 523 } 524} 525 526 527/** 528 * Draws a Bezier curve from the current point, using 3 more control points. 529 * Returns TRUE on success. 530 * 531 * @param resource $p 532 * @param float $x1 533 * @param float $y1 534 * @param float $x2 535 * @param float $y2 536 * @param float $x3 537 * @param float $y3 538 * @throws PdfException 539 * 540 */ 541function PDF_curveto($p, float $x1, float $y1, float $x2, float $y2, float $x3, float $y3): void 542{ 543 error_clear_last(); 544 $result = \PDF_curveto($p, $x1, $y1, $x2, $y2, $x3, $y3); 545 if ($result === false) { 546 throw PdfException::createFromPhpError(); 547 } 548} 549 550 551/** 552 * Deletes a PDFlib object, and frees all internal resources. Returns TRUE on success. 553 * 554 * @param resource $pdfdoc 555 * @throws PdfException 556 * 557 */ 558function PDF_delete($pdfdoc): void 559{ 560 error_clear_last(); 561 $result = \PDF_delete($pdfdoc); 562 if ($result === false) { 563 throw PdfException::createFromPhpError(); 564 } 565} 566 567 568/** 569 * Deactivates all active layers. Returns TRUE on success. 570 * 571 * This function requires PDF 1.5. 572 * 573 * @param resource $pdfdoc 574 * @throws PdfException 575 * 576 */ 577function PDF_end_layer($pdfdoc): void 578{ 579 error_clear_last(); 580 $result = \PDF_end_layer($pdfdoc); 581 if ($result === false) { 582 throw PdfException::createFromPhpError(); 583 } 584} 585 586 587/** 588 * Finishes a page, and applies various options. Returns TRUE on success. 589 * 590 * @param resource $pdfdoc 591 * @param string $optlist 592 * @throws PdfException 593 * 594 */ 595function PDF_end_page_ext($pdfdoc, string $optlist): void 596{ 597 error_clear_last(); 598 $result = \PDF_end_page_ext($pdfdoc, $optlist); 599 if ($result === false) { 600 throw PdfException::createFromPhpError(); 601 } 602} 603 604 605/** 606 * Finishes the page. Returns TRUE on success. 607 * 608 * @param resource $p 609 * @throws PdfException 610 * 611 */ 612function PDF_end_page($p): void 613{ 614 error_clear_last(); 615 $result = \PDF_end_page($p); 616 if ($result === false) { 617 throw PdfException::createFromPhpError(); 618 } 619} 620 621 622/** 623 * Finishes the pattern definition. Returns TRUE on success. 624 * 625 * @param resource $p 626 * @throws PdfException 627 * 628 */ 629function PDF_end_pattern($p): void 630{ 631 error_clear_last(); 632 $result = \PDF_end_pattern($p); 633 if ($result === false) { 634 throw PdfException::createFromPhpError(); 635 } 636} 637 638 639/** 640 * Finishes a template definition. Returns TRUE on success. 641 * 642 * @param resource $p 643 * @throws PdfException 644 * 645 */ 646function PDF_end_template($p): void 647{ 648 error_clear_last(); 649 $result = \PDF_end_template($p); 650 if ($result === false) { 651 throw PdfException::createFromPhpError(); 652 } 653} 654 655 656/** 657 * Fills and strokes the current path with the current fill and stroke color. 658 * Returns TRUE on success. 659 * 660 * @param resource $p 661 * @throws PdfException 662 * 663 */ 664function PDF_fill_stroke($p): void 665{ 666 error_clear_last(); 667 $result = \PDF_fill_stroke($p); 668 if ($result === false) { 669 throw PdfException::createFromPhpError(); 670 } 671} 672 673 674/** 675 * Fills the interior of the current path with the current fill color. 676 * Returns TRUE on success. 677 * 678 * @param resource $p 679 * @throws PdfException 680 * 681 */ 682function PDF_fill($p): void 683{ 684 error_clear_last(); 685 $result = \PDF_fill($p); 686 if ($result === false) { 687 throw PdfException::createFromPhpError(); 688 } 689} 690 691 692/** 693 * Places an image or template on the page, subject to various options. 694 * Returns TRUE on success. 695 * 696 * @param resource $pdfdoc 697 * @param int $image 698 * @param float $x 699 * @param float $y 700 * @param string $optlist 701 * @throws PdfException 702 * 703 */ 704function PDF_fit_image($pdfdoc, int $image, float $x, float $y, string $optlist): void 705{ 706 error_clear_last(); 707 $result = \PDF_fit_image($pdfdoc, $image, $x, $y, $optlist); 708 if ($result === false) { 709 throw PdfException::createFromPhpError(); 710 } 711} 712 713 714/** 715 * Places an imported PDF page on the page, subject to various options. 716 * Returns TRUE on success. 717 * 718 * @param resource $pdfdoc 719 * @param int $page 720 * @param float $x 721 * @param float $y 722 * @param string $optlist 723 * @throws PdfException 724 * 725 */ 726function PDF_fit_pdi_page($pdfdoc, int $page, float $x, float $y, string $optlist): void 727{ 728 error_clear_last(); 729 $result = \PDF_fit_pdi_page($pdfdoc, $page, $x, $y, $optlist); 730 if ($result === false) { 731 throw PdfException::createFromPhpError(); 732 } 733} 734 735 736/** 737 * Places a single line of text on the page, subject to various options. Returns TRUE on success. 738 * 739 * @param resource $pdfdoc 740 * @param string $text 741 * @param float $x 742 * @param float $y 743 * @param string $optlist 744 * @throws PdfException 745 * 746 */ 747function PDF_fit_textline($pdfdoc, string $text, float $x, float $y, string $optlist): void 748{ 749 error_clear_last(); 750 $result = \PDF_fit_textline($pdfdoc, $text, $x, $y, $optlist); 751 if ($result === false) { 752 throw PdfException::createFromPhpError(); 753 } 754} 755 756 757/** 758 * Reset all color and graphics state parameters to their defaults. 759 * Returns TRUE on success. 760 * 761 * @param resource $p 762 * @throws PdfException 763 * 764 */ 765function PDF_initgraphics($p): void 766{ 767 error_clear_last(); 768 $result = \PDF_initgraphics($p); 769 if ($result === false) { 770 throw PdfException::createFromPhpError(); 771 } 772} 773 774 775/** 776 * Draws a line from the current point to another point. Returns TRUE on success. 777 * 778 * @param resource $p 779 * @param float $x 780 * @param float $y 781 * @throws PdfException 782 * 783 */ 784function PDF_lineto($p, float $x, float $y): void 785{ 786 error_clear_last(); 787 $result = \PDF_lineto($p, $x, $y); 788 if ($result === false) { 789 throw PdfException::createFromPhpError(); 790 } 791} 792 793 794/** 795 * Finds a built-in spot color name, or makes a named spot color from the 796 * current fill color. Returns TRUE on success. 797 * 798 * @param resource $p 799 * @param string $spotname 800 * @return int 801 * @throws PdfException 802 * 803 */ 804function PDF_makespotcolor($p, string $spotname): int 805{ 806 error_clear_last(); 807 $result = \PDF_makespotcolor($p, $spotname); 808 if ($result === false) { 809 throw PdfException::createFromPhpError(); 810 } 811 return $result; 812} 813 814 815/** 816 * Sets the current point for graphics output. Returns TRUE on success. 817 * 818 * @param resource $p 819 * @param float $x 820 * @param float $y 821 * @throws PdfException 822 * 823 */ 824function PDF_moveto($p, float $x, float $y): void 825{ 826 error_clear_last(); 827 $result = \PDF_moveto($p, $x, $y); 828 if ($result === false) { 829 throw PdfException::createFromPhpError(); 830 } 831} 832 833 834/** 835 * Creates a new PDF file using the supplied file name. 836 * Returns TRUE on success. 837 * 838 * This function is deprecated since PDFlib version 6, use 839 * PDF_begin_document instead. 840 * 841 * @param resource $p 842 * @param string $filename 843 * @throws PdfException 844 * 845 */ 846function PDF_open_file($p, string $filename): void 847{ 848 error_clear_last(); 849 $result = \PDF_open_file($p, $filename); 850 if ($result === false) { 851 throw PdfException::createFromPhpError(); 852 } 853} 854 855 856/** 857 * Places an image and scales it. Returns TRUE on success. 858 * 859 * This function is deprecated since PDFlib version 5, use 860 * PDF_fit_image instead. 861 * 862 * @param resource $pdfdoc 863 * @param int $image 864 * @param float $x 865 * @param float $y 866 * @param float $scale 867 * @throws PdfException 868 * 869 */ 870function PDF_place_image($pdfdoc, int $image, float $x, float $y, float $scale): void 871{ 872 error_clear_last(); 873 $result = \PDF_place_image($pdfdoc, $image, $x, $y, $scale); 874 if ($result === false) { 875 throw PdfException::createFromPhpError(); 876 } 877} 878 879 880/** 881 * Places a PDF page and scales it. Returns TRUE on success. 882 * 883 * This function is deprecated since PDFlib version 5, use 884 * PDF_fit_pdi_page instead. 885 * 886 * @param resource $pdfdoc 887 * @param int $page 888 * @param float $x 889 * @param float $y 890 * @param float $sx 891 * @param float $sy 892 * @throws PdfException 893 * 894 */ 895function PDF_place_pdi_page($pdfdoc, int $page, float $x, float $y, float $sx, float $sy): void 896{ 897 error_clear_last(); 898 $result = \PDF_place_pdi_page($pdfdoc, $page, $x, $y, $sx, $sy); 899 if ($result === false) { 900 throw PdfException::createFromPhpError(); 901 } 902} 903 904 905/** 906 * Draws a rectangle. Returns TRUE on success. 907 * 908 * @param resource $p 909 * @param float $x 910 * @param float $y 911 * @param float $width 912 * @param float $height 913 * @throws PdfException 914 * 915 */ 916function PDF_rect($p, float $x, float $y, float $width, float $height): void 917{ 918 error_clear_last(); 919 $result = \PDF_rect($p, $x, $y, $width, $height); 920 if ($result === false) { 921 throw PdfException::createFromPhpError(); 922 } 923} 924 925 926/** 927 * Restores the most recently saved graphics state. Returns TRUE on success. 928 * 929 * @param resource $p 930 * @throws PdfException 931 * 932 */ 933function PDF_restore($p): void 934{ 935 error_clear_last(); 936 $result = \PDF_restore($p); 937 if ($result === false) { 938 throw PdfException::createFromPhpError(); 939 } 940} 941 942 943/** 944 * Rotates the coordinate system. Returns TRUE on success. 945 * 946 * @param resource $p 947 * @param float $phi 948 * @throws PdfException 949 * 950 */ 951function PDF_rotate($p, float $phi): void 952{ 953 error_clear_last(); 954 $result = \PDF_rotate($p, $phi); 955 if ($result === false) { 956 throw PdfException::createFromPhpError(); 957 } 958} 959 960 961/** 962 * Saves the current graphics state. Returns TRUE on success. 963 * 964 * @param resource $p 965 * @throws PdfException 966 * 967 */ 968function PDF_save($p): void 969{ 970 error_clear_last(); 971 $result = \PDF_save($p); 972 if ($result === false) { 973 throw PdfException::createFromPhpError(); 974 } 975} 976 977 978/** 979 * Scales the coordinate system. Returns TRUE on success. 980 * 981 * @param resource $p 982 * @param float $sx 983 * @param float $sy 984 * @throws PdfException 985 * 986 */ 987function PDF_scale($p, float $sx, float $sy): void 988{ 989 error_clear_last(); 990 $result = \PDF_scale($p, $sx, $sy); 991 if ($result === false) { 992 throw PdfException::createFromPhpError(); 993 } 994} 995 996 997/** 998 * Sets the border color for all kinds of annotations. Returns TRUE on success. 999 * 1000 * This function is deprecated since PDFlib version 6, use 1001 * the option annotcolor in 1002 * PDF_create_annotation instead. 1003 * 1004 * @param resource $p 1005 * @param float $red 1006 * @param float $green 1007 * @param float $blue 1008 * @throws PdfException 1009 * 1010 */ 1011function PDF_set_border_color($p, float $red, float $green, float $blue): void 1012{ 1013 error_clear_last(); 1014 $result = \PDF_set_border_color($p, $red, $green, $blue); 1015 if ($result === false) { 1016 throw PdfException::createFromPhpError(); 1017 } 1018} 1019 1020 1021/** 1022 * Sets the border dash style for all kinds of annotations. Returns TRUE on success. 1023 * 1024 * This function is deprecated since PDFlib version 6, use 1025 * the option dasharray in 1026 * PDF_create_annotation instead. 1027 * 1028 * @param resource $pdfdoc 1029 * @param float $black 1030 * @param float $white 1031 * @throws PdfException 1032 * 1033 */ 1034function PDF_set_border_dash($pdfdoc, float $black, float $white): void 1035{ 1036 error_clear_last(); 1037 $result = \PDF_set_border_dash($pdfdoc, $black, $white); 1038 if ($result === false) { 1039 throw PdfException::createFromPhpError(); 1040 } 1041} 1042 1043 1044/** 1045 * Sets the border style for all kinds of annotations. Returns TRUE on success. 1046 * 1047 * This function is deprecated since PDFlib version 6, use 1048 * the options borderstyle and 1049 * linewidth in 1050 * PDF_create_annotation instead. 1051 * 1052 * @param resource $pdfdoc 1053 * @param string $style 1054 * @param float $width 1055 * @throws PdfException 1056 * 1057 */ 1058function PDF_set_border_style($pdfdoc, string $style, float $width): void 1059{ 1060 error_clear_last(); 1061 $result = \PDF_set_border_style($pdfdoc, $style, $width); 1062 if ($result === false) { 1063 throw PdfException::createFromPhpError(); 1064 } 1065} 1066 1067 1068/** 1069 * Fill document information field key with 1070 * value. Returns TRUE on success. 1071 * 1072 * @param resource $p 1073 * @param string $key 1074 * @param string $value 1075 * @throws PdfException 1076 * 1077 */ 1078function PDF_set_info($p, string $key, string $value): void 1079{ 1080 error_clear_last(); 1081 $result = \PDF_set_info($p, $key, $value); 1082 if ($result === false) { 1083 throw PdfException::createFromPhpError(); 1084 } 1085} 1086 1087 1088/** 1089 * Defines hierarchical and group relationships among layers. Returns TRUE on success. 1090 * 1091 * This function requires PDF 1.5. 1092 * 1093 * @param resource $pdfdoc 1094 * @param string $type 1095 * @param string $optlist 1096 * @throws PdfException 1097 * 1098 */ 1099function PDF_set_layer_dependency($pdfdoc, string $type, string $optlist): void 1100{ 1101 error_clear_last(); 1102 $result = \PDF_set_layer_dependency($pdfdoc, $type, $optlist); 1103 if ($result === false) { 1104 throw PdfException::createFromPhpError(); 1105 } 1106} 1107 1108 1109/** 1110 * Sets some PDFlib parameter with string type. Returns TRUE on success. 1111 * 1112 * @param resource $p 1113 * @param string $key 1114 * @param string $value 1115 * @throws PdfException 1116 * 1117 */ 1118function PDF_set_parameter($p, string $key, string $value): void 1119{ 1120 error_clear_last(); 1121 $result = \PDF_set_parameter($p, $key, $value); 1122 if ($result === false) { 1123 throw PdfException::createFromPhpError(); 1124 } 1125} 1126 1127 1128/** 1129 * Sets the position for text output on the page. Returns TRUE on success. 1130 * 1131 * @param resource $p 1132 * @param float $x 1133 * @param float $y 1134 * @throws PdfException 1135 * 1136 */ 1137function PDF_set_text_pos($p, float $x, float $y): void 1138{ 1139 error_clear_last(); 1140 $result = \PDF_set_text_pos($p, $x, $y); 1141 if ($result === false) { 1142 throw PdfException::createFromPhpError(); 1143 } 1144} 1145 1146 1147/** 1148 * Sets the value of some PDFlib parameter with numerical type. Returns TRUE on success. 1149 * 1150 * @param resource $p 1151 * @param string $key 1152 * @param float $value 1153 * @throws PdfException 1154 * 1155 */ 1156function PDF_set_value($p, string $key, float $value): void 1157{ 1158 error_clear_last(); 1159 $result = \PDF_set_value($p, $key, $value); 1160 if ($result === false) { 1161 throw PdfException::createFromPhpError(); 1162 } 1163} 1164 1165 1166/** 1167 * Sets the current color space and color. Returns TRUE on success. 1168 * 1169 * @param resource $p 1170 * @param string $fstype 1171 * @param string $colorspace 1172 * @param float $c1 1173 * @param float $c2 1174 * @param float $c3 1175 * @param float $c4 1176 * @throws PdfException 1177 * 1178 */ 1179function PDF_setcolor($p, string $fstype, string $colorspace, float $c1, float $c2, float $c3, float $c4): void 1180{ 1181 error_clear_last(); 1182 $result = \PDF_setcolor($p, $fstype, $colorspace, $c1, $c2, $c3, $c4); 1183 if ($result === false) { 1184 throw PdfException::createFromPhpError(); 1185 } 1186} 1187 1188 1189/** 1190 * Sets the current dash pattern to b black 1191 * and w white units. Returns TRUE on success. 1192 * 1193 * @param resource $pdfdoc 1194 * @param float $b 1195 * @param float $w 1196 * @throws PdfException 1197 * 1198 */ 1199function PDF_setdash($pdfdoc, float $b, float $w): void 1200{ 1201 error_clear_last(); 1202 $result = \PDF_setdash($pdfdoc, $b, $w); 1203 if ($result === false) { 1204 throw PdfException::createFromPhpError(); 1205 } 1206} 1207 1208 1209/** 1210 * Sets a dash pattern defined by an option list. Returns TRUE on success. 1211 * 1212 * @param resource $pdfdoc 1213 * @param string $optlist 1214 * @throws PdfException 1215 * 1216 */ 1217function PDF_setdashpattern($pdfdoc, string $optlist): void 1218{ 1219 error_clear_last(); 1220 $result = \PDF_setdashpattern($pdfdoc, $optlist); 1221 if ($result === false) { 1222 throw PdfException::createFromPhpError(); 1223 } 1224} 1225 1226 1227/** 1228 * Sets the flatness parameter. Returns TRUE on success. 1229 * 1230 * @param resource $pdfdoc 1231 * @param float $flatness 1232 * @throws PdfException 1233 * 1234 */ 1235function PDF_setflat($pdfdoc, float $flatness): void 1236{ 1237 error_clear_last(); 1238 $result = \PDF_setflat($pdfdoc, $flatness); 1239 if ($result === false) { 1240 throw PdfException::createFromPhpError(); 1241 } 1242} 1243 1244 1245/** 1246 * Sets the current font in the specified fontsize, using a 1247 * font handle returned by PDF_load_font. 1248 * Returns TRUE on success. 1249 * 1250 * @param resource $pdfdoc 1251 * @param int $font 1252 * @param float $fontsize 1253 * @throws PdfException 1254 * 1255 */ 1256function PDF_setfont($pdfdoc, int $font, float $fontsize): void 1257{ 1258 error_clear_last(); 1259 $result = \PDF_setfont($pdfdoc, $font, $fontsize); 1260 if ($result === false) { 1261 throw PdfException::createFromPhpError(); 1262 } 1263} 1264 1265 1266/** 1267 * Sets the current fill color to a gray value between 0 and 1 inclusive. 1268 * Returns TRUE on success. 1269 * 1270 * This function is deprecated since PDFlib version 4, use 1271 * PDF_setcolor instead. 1272 * 1273 * @param resource $p 1274 * @param float $g 1275 * @throws PdfException 1276 * 1277 */ 1278function PDF_setgray_fill($p, float $g): void 1279{ 1280 error_clear_last(); 1281 $result = \PDF_setgray_fill($p, $g); 1282 if ($result === false) { 1283 throw PdfException::createFromPhpError(); 1284 } 1285} 1286 1287 1288/** 1289 * Sets the current stroke color to a gray value between 0 and 1 inclusive. 1290 * Returns TRUE on success. 1291 * 1292 * This function is deprecated since PDFlib version 4, use 1293 * PDF_setcolor instead. 1294 * 1295 * @param resource $p 1296 * @param float $g 1297 * @throws PdfException 1298 * 1299 */ 1300function PDF_setgray_stroke($p, float $g): void 1301{ 1302 error_clear_last(); 1303 $result = \PDF_setgray_stroke($p, $g); 1304 if ($result === false) { 1305 throw PdfException::createFromPhpError(); 1306 } 1307} 1308 1309 1310/** 1311 * Sets the current fill and stroke color to a gray value between 0 and 1 inclusive. Returns TRUE on success. 1312 * 1313 * This function is deprecated since PDFlib version 4, use 1314 * PDF_setcolor instead. 1315 * 1316 * @param resource $p 1317 * @param float $g 1318 * @throws PdfException 1319 * 1320 */ 1321function PDF_setgray($p, float $g): void 1322{ 1323 error_clear_last(); 1324 $result = \PDF_setgray($p, $g); 1325 if ($result === false) { 1326 throw PdfException::createFromPhpError(); 1327 } 1328} 1329 1330 1331/** 1332 * Sets the linejoin parameter to specify the shape 1333 * at the corners of paths that are stroked. Returns TRUE on success. 1334 * 1335 * @param resource $p 1336 * @param int $value 1337 * @throws PdfException 1338 * 1339 */ 1340function PDF_setlinejoin($p, int $value): void 1341{ 1342 error_clear_last(); 1343 $result = \PDF_setlinejoin($p, $value); 1344 if ($result === false) { 1345 throw PdfException::createFromPhpError(); 1346 } 1347} 1348 1349 1350/** 1351 * Sets the current line width. Returns TRUE on success. 1352 * 1353 * @param resource $p 1354 * @param float $width 1355 * @throws PdfException 1356 * 1357 */ 1358function PDF_setlinewidth($p, float $width): void 1359{ 1360 error_clear_last(); 1361 $result = \PDF_setlinewidth($p, $width); 1362 if ($result === false) { 1363 throw PdfException::createFromPhpError(); 1364 } 1365} 1366 1367 1368/** 1369 * Explicitly sets the current transformation matrix. Returns TRUE on success. 1370 * 1371 * @param resource $p 1372 * @param float $a 1373 * @param float $b 1374 * @param float $c 1375 * @param float $d 1376 * @param float $e 1377 * @param float $f 1378 * @throws PdfException 1379 * 1380 */ 1381function PDF_setmatrix($p, float $a, float $b, float $c, float $d, float $e, float $f): void 1382{ 1383 error_clear_last(); 1384 $result = \PDF_setmatrix($p, $a, $b, $c, $d, $e, $f); 1385 if ($result === false) { 1386 throw PdfException::createFromPhpError(); 1387 } 1388} 1389 1390 1391/** 1392 * Sets the miter limit.Returns TRUE on success. 1393 * 1394 * @param resource $pdfdoc 1395 * @param float $miter 1396 * @throws PdfException 1397 * 1398 */ 1399function PDF_setmiterlimit($pdfdoc, float $miter): void 1400{ 1401 error_clear_last(); 1402 $result = \PDF_setmiterlimit($pdfdoc, $miter); 1403 if ($result === false) { 1404 throw PdfException::createFromPhpError(); 1405 } 1406} 1407 1408 1409/** 1410 * Sets the current fill color to the supplied RGB values. Returns TRUE on success. 1411 * 1412 * This function is deprecated since PDFlib version 4, use 1413 * PDF_setcolor instead. 1414 * 1415 * @param resource $p 1416 * @param float $red 1417 * @param float $green 1418 * @param float $blue 1419 * @throws PdfException 1420 * 1421 */ 1422function PDF_setrgbcolor_fill($p, float $red, float $green, float $blue): void 1423{ 1424 error_clear_last(); 1425 $result = \PDF_setrgbcolor_fill($p, $red, $green, $blue); 1426 if ($result === false) { 1427 throw PdfException::createFromPhpError(); 1428 } 1429} 1430 1431 1432/** 1433 * Sets the current stroke color to the supplied RGB values. Returns TRUE on success. 1434 * 1435 * This function is deprecated since PDFlib version 4, use 1436 * PDF_setcolor instead. 1437 * 1438 * @param resource $p 1439 * @param float $red 1440 * @param float $green 1441 * @param float $blue 1442 * @throws PdfException 1443 * 1444 */ 1445function PDF_setrgbcolor_stroke($p, float $red, float $green, float $blue): void 1446{ 1447 error_clear_last(); 1448 $result = \PDF_setrgbcolor_stroke($p, $red, $green, $blue); 1449 if ($result === false) { 1450 throw PdfException::createFromPhpError(); 1451 } 1452} 1453 1454 1455/** 1456 * Sets the current fill and stroke color to the supplied RGB values. 1457 * Returns TRUE on success. 1458 * 1459 * This function is deprecated since PDFlib version 4, use 1460 * PDF_setcolor instead. 1461 * 1462 * @param resource $p 1463 * @param float $red 1464 * @param float $green 1465 * @param float $blue 1466 * @throws PdfException 1467 * 1468 */ 1469function PDF_setrgbcolor($p, float $red, float $green, float $blue): void 1470{ 1471 error_clear_last(); 1472 $result = \PDF_setrgbcolor($p, $red, $green, $blue); 1473 if ($result === false) { 1474 throw PdfException::createFromPhpError(); 1475 } 1476} 1477 1478 1479/** 1480 * Prints text in the current font. Returns TRUE on success. 1481 * 1482 * @param resource $p 1483 * @param string $text 1484 * @param float $x 1485 * @param float $y 1486 * @throws PdfException 1487 * 1488 */ 1489function PDF_show_xy($p, string $text, float $x, float $y): void 1490{ 1491 error_clear_last(); 1492 $result = \PDF_show_xy($p, $text, $x, $y); 1493 if ($result === false) { 1494 throw PdfException::createFromPhpError(); 1495 } 1496} 1497 1498 1499/** 1500 * Prints text in the current font and size at 1501 * the current position. Returns TRUE on success. 1502 * 1503 * @param resource $pdfdoc 1504 * @param string $text 1505 * @throws PdfException 1506 * 1507 */ 1508function PDF_show($pdfdoc, string $text): void 1509{ 1510 error_clear_last(); 1511 $result = \PDF_show($pdfdoc, $text); 1512 if ($result === false) { 1513 throw PdfException::createFromPhpError(); 1514 } 1515} 1516 1517 1518/** 1519 * Skews the coordinate system in x and y direction by alpha 1520 * and beta degrees, respectively. Returns TRUE on success. 1521 * 1522 * @param resource $p 1523 * @param float $alpha 1524 * @param float $beta 1525 * @throws PdfException 1526 * 1527 */ 1528function PDF_skew($p, float $alpha, float $beta): void 1529{ 1530 error_clear_last(); 1531 $result = \PDF_skew($p, $alpha, $beta); 1532 if ($result === false) { 1533 throw PdfException::createFromPhpError(); 1534 } 1535} 1536 1537 1538/** 1539 * Strokes the path with the current color and line width, and clear it. 1540 * Returns TRUE on success. 1541 * 1542 * @param resource $p 1543 * @throws PdfException 1544 * 1545 */ 1546function PDF_stroke($p): void 1547{ 1548 error_clear_last(); 1549 $result = \PDF_stroke($p); 1550 if ($result === false) { 1551 throw PdfException::createFromPhpError(); 1552 } 1553} 1554