Hướng dẫn pdftk php - pdftk php
Chuyển đổi PDF và hình thức tiện ích dựa trên PDFTK. Đặc trưngPHP -PDFTK mang toàn bộ sức mạnh của use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }0 cho PHP - và hơn thế nữa.
Yêu cầu
Cài đặtBạn nên sử dụng nhà soạn nhạc để cài đặt thư viện này.
Ví dụTạo phiên bản cho các tệp PDFCó một số cách để cho biết phiên bản use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }6 mà tệp mà nó nên sử dụng. Một số tệp cũng có thể yêu cầu mật khẩu hoặc cần một bí danh được sử dụng làm xử lý trong một số hoạt động (ví dụ: Cat hoặc Shuffle).
// Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]); Hoạt độngVui lòng tham khảo trang người đàn ông use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }0 cho mỗi thao tác để tìm hiểu cách mỗi hoạt động hoạt động chi tiết và có sẵn tùy chọn nào. Đối với tất cả các hoạt động, bạn có thể lưu pdf cục bộ thông qua use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }8 hoặc gửi nó đến trình duyệt với use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }9. Nếu bạn chuyển tên tệp cho use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm($data) ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf') ->saveAs('filled.pdf');0 Trình duyệt máy khách sẽ mở đoạn hội thoại tải xuống trong khi không có tên tệp, nó thường sẽ hiển thị nội tuyến PDF. Quan trọng: Bạn luôn chỉ có thể thực hiện một trong các hoạt động sau trên một phiên bản PDF duy nhất. Dưới đây bạn có thể tìm thấy một cách giải quyết nếu bạn cần nhiều hoạt động. Điền vào mẫuĐiền vào biểu mẫu PDF với dữ liệu từ mảng PHP hoặc tệp XFDF/FDF. use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); } Lưu ý: Khi điền vào dữ liệu UTF-8, bạn phải luôn thêm tùy chọn use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm($data) ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf') ->saveAs('filled.pdf');1 option. This will make sure, that the PDF reader takes care of using the right fonts for rendering, something that pdftk can't do for you. Also note that use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm($data) ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf') ->saveAs('filled.pdf');2 doesn't really work well if you have special characters in your data. Nếu bạn sử dụng use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }4> = 3.3.0 và phông chữ được nhúng không hỗ trợ các ký tự UTF-8, bạn cũng có thể thay thế nó bằng phông chữ cục bộ: use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm($data) ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf') ->saveAs('filled.pdf'); Tạo tệp XFDF/FDF từ mảng PHPĐây là một tính năng tiền thưởng không có sẵn từ use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }0. use mikehaertl\pdftk\XfdfFile; use mikehaertl\pdftk\FdfFile; $xfdf = new XfdfFile(['name' => 'Jürgen мирано']); $xfdf->saveAs('/path/to/data.xfdf'); $fdf = new FdfFile(['name' => 'Jürgen мирано']); $fdf->saveAs('/path/to/data.fdf'); Con mèoLắp một tệp PDF từ các trang từ một hoặc nhiều tệp PDF. use mikehaertl\pdftk\Pdf; // Extract pages 1-5 and 7,4,9 into a new file $pdf = new Pdf('/path/to/my.pdf'); $result = $pdf->cat(1, 5) ->cat([7, 4, 9]) ->saveAs('/path/to/new.pdf'); if ($result === false) { $error = $pdf->getError(); } // Combine pages from several files $pdf = new Pdf([ 'A' => '/path/file1.pdf', // A is alias for file1.pdf 'B' => ['/path/file2.pdf','pass**word'], // B is alias for file2.pdf 'C' => ['/path/file3.pdf','secret**pw'], // C is alias for file3.pdf ]); $result = $pdf->cat(1, 5, 'A') // pages 1-5 from A ->cat(3, null, 'B') // page 3 from B ->cat(7, 'end', 'B', null, 'east') // pages 7-end from B, rotated East ->cat('end',3,'A','even') // even pages 3-end in reverse order from A ->cat([2,3,7], 'C') // pages 2,3 and 7 from C ->saveAs('/path/new.pdf'); if ($result === false) { $error = $pdf->getError(); } Xáo trộnGiống như use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm($data) ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf') ->saveAs('filled.pdf');5 nhưng tạo "luồng" và điền PDF mới bằng một trang từ mỗi luồng tại một thời điểm. use mikehaertl\pdftk\Pdf; $pdf = new Pdf([ 'A' => '/path/file1.pdf', // A is alias for file1.pdf 'B' => '/path/file2.pdf', // B is alias for file2.pdf ]); // new.pdf will have pages A1, B3, A2, B4, A3, B5, ... $result = $pdf->shuffle(1, 5, 'A') // pages 1-5 from A ->shuffle(3, 8, 'B') // pages 3-8 from B ->saveAs('/path/new.pdf'); if ($result === false) { $error = $pdf->getError(); } NổChia tệp PDF thành một tệp trên mỗi trang. use mikehaertl\pdftk\Pdf; $pdf = new Pdf('/path/my.pdf'); $result = $pdf->burst('/path/page_%d.pdf'); // Supply a printf() pattern if ($result === false) { $error = $pdf->getError(); } Thêm nền PDFThêm một tệp PDF khác làm nền. use mikehaertl\pdftk\Pdf; // Set background from another PDF (first page repeated) $pdf = new Pdf('/path/my.pdf'); $result = $pdf->background('/path/back.pdf') ->saveAs('/path/watermarked.pdf'); if ($result === false) { $error = $pdf->getError(); } // Set background from another PDF (one page each) $pdf = new Pdf('/path/my.pdf'); $result = $pdf->multiBackground('/path/back_pages.pdf') ->saveAs('/path/watermarked.pdf'); if ($result === false) { $error = $pdf->getError(); } Thêm PDF lớp phủThêm một tệp PDF khác dưới dạng lớp phủ. use mikehaertl\pdftk\Pdf; // Stamp with another PDF (first page repeated) $pdf = new Pdf('/path/my.pdf'); $result = $pdf->stamp('/path/overlay.pdf') ->saveAs('/path/stamped.pdf'); if ($result === false) { $error = $pdf->getError(); } // Stamp with another PDF (one page each) $pdf = new Pdf('/path/my.pdf'); $result = $pdf->multiStamp('/path/overlay_pages.pdf') ->saveAs('/path/stamped.pdf'); if ($result === false) { $error = $pdf->getError(); } Đính kèm tệpThêm tệp đính kèm tệp vào tài liệu hoặc vào một trang cụ thể. // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);0 Giải nén các tập tinSao chép tệp đính kèm từ tệp PDF đến thư mục đã cho. // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);1 Tạo FDFTạo một tệp FDF từ một biểu mẫu PDF được điền nhất định. // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);2 Nhận dữ liệu PDFĐọc ra siêu dữ liệu hoặc hình thức thông tin trường từ tệp PDF. // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);3 Cách thực hiện nhiều hơn một thao tác trên PDFNhư đã nêu ở trên, bạn chỉ có thể thực hiện một trong các hoạt động trước trên một phiên bản PDF duy nhất. Nếu bạn cần nhiều hơn một thao tác, bạn có thể đưa một phiên bản use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }6 vào một hoạt động khác: // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);4 Tùy chọnBạn có thể kết hợp các hoạt động trên với một hoặc nhiều tùy chọn sau. // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);5 Lệnh shellLớp sử dụng PHP-ShellCommand để thực thi use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }0. Bạn có thể vượt qua use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm($data) ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf') ->saveAs('filled.pdf');8 cho lớp use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm($data) ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf') ->saveAs('filled.pdf');9 của nó dưới dạng đối số thứ hai cho hàm tạo: // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);6 Giải quyết các vấn đề với các ký tự UTF-8 trong tên tệp hoặc nội dung vô hạnNếu bạn có các tệp có các ký tự được mã hóa UTF-8 trong tên tệp của họ hoặc nếu bạn chuyển một infofile với các ký tự như vậy cho use mikehaertl\pdftk\XfdfFile; use mikehaertl\pdftk\FdfFile; $xfdf = new XfdfFile(['name' => 'Jürgen мирано']); $xfdf->saveAs('/path/to/data.xfdf'); $fdf = new FdfFile(['name' => 'Jürgen мирано']); $fdf->saveAs('/path/to/data.fdf');0, bạn nên cung cấp đúng địa điểm khi cắt bỏ use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }0. Do đó, bạn có thể thêm các tùy chọn sau: // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);7
Tập tin tạm thờiTrong nội bộ, một tệp tạm thời được tạo thông qua PHP-TMPFILE.Bạn cũng có thể truy cập trực tiếp tệp đó, ví dụ:Nếu bạn không muốn gửi hoặc lưu tệp nhưng chỉ cần nội dung pdf nhị phân: // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);8 Nếu bạn có vấn đề về quyền, bạn có thể phải đặt một thư mục trong đó lệnh use mikehaertl\pdftk\Pdf; // Fill form with data array $pdf = new Pdf('/full/path/to/form.pdf'); $result = $pdf->fillForm([ 'name'=>'ÄÜÖ äüö мирано čárka', 'nested.name' => 'valX', ]) ->needAppearances() ->saveAs('filled.pdf'); // Always check for errors if ($result === false) { $error = $pdf->getError(); } // Fill form from FDF $pdf = new Pdf('form.pdf'); $result = $pdf->fillForm('data.xfdf') ->saveAs('filled.pdf'); if ($result === false) { $error = $pdf->getError(); }0 của bạn có thể viết cho: // Create an instance for a single file $pdf = new Pdf('/path/to/form.pdf'); // Alternatively add files later. Handles are autogenerated in this case. $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf'); $pdf->addFile('/path/to/file2.pdf'); // Add files with own handle $pdf = new Pdf(); $pdf->addFile('/path/to/file1.pdf', 'A'); $pdf->addFile('/path/to/file2.pdf', 'B'); // Add file with handle and password $pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password'); // Shortcut to pass all files to the constructor $pdf = new Pdf([ 'A' => ['/path/to/file1.pdf', 'secret*password1'], 'B' => ['/path/to/file2.pdf', 'secret*password2'], ]);9 APIVui lòng tham khảo các tệp nguồn để biết tài liệu đầy đủ của từng phương thức. |