@@ -59,7 +59,7 @@ Fill a PDF form with data from a PHP array or an XFDF/FDF file.
5959use mikehaertl\pdftk\Pdf;
6060
6161// Fill form with data array
62- $pdf = new Pdf('form.pdf');
62+ $pdf = new Pdf('/full/path/to/ form.pdf');
6363$pdf->fillForm(array(
6464 'name'=>'ÄÜÖ äüö мирано čárka',
6565 'nested.name' => 'valX',
@@ -91,10 +91,10 @@ This is a bonus feature that is not available from `pdftk`.
9191use mikehaertl\pdftk\FdfFile;
9292
9393$fdf = new XfdfFile(['name'=>'Jürgen мирано']);
94- $fdf->saveAs('data.xfdf');
94+ $fdf->saveAs('/path/to/ data.xfdf');
9595
9696$fdf = new FdfFile(['name'=>'Jürgen мирано']);
97- $fdf->saveAs('data.fdf');
97+ $fdf->saveAs('/path/to/ data.fdf');
9898```
9999
100100#### Cat
@@ -105,23 +105,23 @@ Assemble a PDF from pages of one or more PDF files.
105105use mikehaertl\pdftk\Pdf;
106106
107107// Extract pages 1-5 and 7,4,9 into a new file
108- $pdf = new Pdf('my.pdf');
108+ $pdf = new Pdf('/path/to/ my.pdf');
109109$pdf->cat(1, 5)
110110 ->cat(array(7, 4, 9))
111- ->saveAs('new.pdf');
111+ ->saveAs('/path/to/ new.pdf');
112112
113113// Combine pages from several files, demonstrating several ways how to add files
114114$pdf = new Pdf(array(
115- 'A' => 'file1.pdf', // Reference file as 'A'
116- 'B' => ['file2.pdf','pass**word'], // Reference file as 'B'
115+ 'A' => '/path/ file1.pdf', // Reference file as 'A'
116+ 'B' => ['/path/ file2.pdf','pass**word'], // Reference file as 'B'
117117));
118- $pdf->addFile('file3.pdf','C','**secret**pw'); // Reference file as 'C'
118+ $pdf->addFile('/path/ file3.pdf','C','**secret**pw'); // Reference file as 'C'
119119$pdf->cat(1, 5, 'A') // pages 1-5 from A
120120 ->cat(3, null, 'B') // page 3 from B
121121 ->cat(7, 'end', 'B', null, 'east') // pages 7-end from B, rotated East
122122 ->cat('end',3,'A','even') // even pages 3-end in reverse order from A
123123 ->cat([2,3,7], 'C') // pages 2,3 and 7 from C
124- ->saveAs('new.pdf');
124+ ->saveAs('/path/ new.pdf');
125125```
126126
127127#### Shuffle
@@ -133,14 +133,14 @@ stream at a time.
133133use mikehaertl\pdftk\Pdf;
134134
135135$pdf = new Pdf(array(
136- 'A' => 'file1.pdf', // Reference file as 'A'
137- 'B' => 'file2.pdf', // Reference file as 'B'
136+ 'A' => '/path/ file1.pdf', // Reference file as 'A'
137+ 'B' => '/path/ file2.pdf', // Reference file as 'B'
138138));
139139
140140// new.pdf will have pages A1, B3, A2, B4, A3, B5, ...
141141$pdf->shuffle(1, 5, 'A') // pages 1-5 from A
142142 ->shuffle(3, 8, 'B') // pages 3-8 from B
143- ->saveAs('new.pdf');
143+ ->saveAs('/path/ new.pdf');
144144```
145145
146146#### Burst
@@ -150,8 +150,8 @@ Split a PDF file into one file per page.
150150``` php
151151use mikehaertl\pdftk\Pdf;
152152
153- $pdf = new Pdf('my.pdf');
154- $pdf->burst('page_%d.pdf'); // Supply a printf() pattern
153+ $pdf = new Pdf('/path/ my.pdf');
154+ $pdf->burst('/path/ page_%d.pdf'); // Supply a printf() pattern
155155```
156156
157157#### Add background PDF
@@ -162,14 +162,14 @@ Add another PDF file as background.
162162use mikehaertl\pdftk\Pdf;
163163
164164// Set background from another PDF (first page repeated)
165- $pdf = new Pdf('my.pdf');
166- $pdf->background('back.pdf')
167- ->saveAs('watermarked.pdf');
165+ $pdf = new Pdf('/path/ my.pdf');
166+ $pdf->background('/path/ back.pdf')
167+ ->saveAs('/path/ watermarked.pdf');
168168
169169// Set background from another PDF (one page each)
170- $pdf = new Pdf('my.pdf');
171- $pdf->multiBackground('back_pages.pdf')
172- ->saveAs('watermarked.pdf');
170+ $pdf = new Pdf('/path/ my.pdf');
171+ $pdf->multiBackground('/path/ back_pages.pdf')
172+ ->saveAs('/path/ watermarked.pdf');
173173```
174174
175175#### Add overlay PDF
@@ -180,14 +180,14 @@ Add another PDF file as overlay.
180180use mikehaertl\pdftk\Pdf;
181181
182182// Stamp with another PDF (first page repeated)
183- $pdf = new Pdf('my.pdf');
184- $pdf->stamp('overlay.pdf')
185- ->saveAs('stamped.pdf');
183+ $pdf = new Pdf('/path/ my.pdf');
184+ $pdf->stamp('/path/ overlay.pdf')
185+ ->saveAs('/path/ stamped.pdf');
186186
187187// Stamp with another PDF (one page each)
188- $pdf = new Pdf('my.pdf');
189- $pdf->multiStamp('overlay_pages.pdf')
190- ->saveAs('stamped.pdf');
188+ $pdf = new Pdf('/path/ my.pdf');
189+ $pdf->multiStamp('/path/ overlay_pages.pdf')
190+ ->saveAs('/path/ stamped.pdf');
191191```
192192
193193#### Generate FDF
@@ -198,8 +198,8 @@ Create a FDF file from a given filled PDF form.
198198use mikehaertl\pdftk\Pdf;
199199
200200// Create FDF from PDF
201- $pdf = new Pdf('form.pdf');
202- $pdf->generateFdfFile('data.fdf');
201+ $pdf = new Pdf('/path/ form.pdf');
202+ $pdf->generateFdfFile('/path/ data.fdf');
203203```
204204
205205#### Get PDF data
@@ -210,11 +210,11 @@ Read out metadata or form field information from a PDF file.
210210use mikehaertl\pdftk\Pdf;
211211
212212// Get data
213- $pdf = new Pdf('my.pdf');
213+ $pdf = new Pdf('/path/ my.pdf');
214214$data = $pdf->getData();
215215
216216// Get form data fields
217- $pdf = new Pdf('my.pdf');
217+ $pdf = new Pdf('/path/ my.pdf');
218218$data = $pdf->getDataFields();
219219```
220220
@@ -227,15 +227,15 @@ If you need more than one operation you can feed one `Pdf` instance into another
227227use mikehaertl\pdftk\Pdf;
228228
229229// Extract pages 1-5 and 7,4,9 into a new file
230- $pdf = new Pdf('my.pdf');
230+ $pdf = new Pdf('/path/ my.pdf');
231231$pdf->cat(1, 5)
232232 ->cat(array(7, 4, 9));
233233
234234// We now use the above PDF as source file for a new PDF
235235$pdf2 = new Pdf($pdf);
236236$pdf2->fillForm(array('name'=>'ÄÜÖ äüö мирано čárka'))
237237 ->needAppearances()
238- ->saveAs('filled.pdf');
238+ ->saveAs('/path/ filled.pdf');
239239```
240240
241241### Options
@@ -245,7 +245,7 @@ You can combine the above operations with one or more of the following options.
245245``` php
246246use mikehaertl\pdftk\Pdf;
247247
248- $pdf = new Pdf('my.pdf');
248+ $pdf = new Pdf('/path/ my.pdf');
249249
250250$pdf->allow('AllFeatures') // Change permissions
251251 ->flatten() // Merge form data into document (doesn't work well with UTF-8!)
@@ -261,15 +261,15 @@ $pdf->allow('AllFeatures') // Change permissions
261261
262262// Example: Fill PDF form and merge form data into PDF
263263// Fill form with data array
264- $pdf = new Pdf('form.pdf');
264+ $pdf = new Pdf('/path/ form.pdf');
265265$pdf->fillForm(array('name'=>'My Name'))
266266 ->flatten()
267- ->saveAs('filled.pdf');
267+ ->saveAs('/path/ filled.pdf');
268268
269269// Example: Remove password from a PDF
270270$pdf = new Pdf;
271- $pdf->addPage('my.pdf', null, 'some**password')
272- ->saveAs('new.pdf');
271+ $pdf->addPage('/path/ my.pdf', null, 'some**password')
272+ ->saveAs('/path/ new.pdf');
273273```
274274
275275### Execution
@@ -280,8 +280,10 @@ The class uses [php-shellcommand](https://github.com/mikehaertl/php-shellcommand
280280``` php
281281use mikehaertl\pdftk\Pdf;
282282
283- $pdf = new Pdf('my.pdf', [
283+ $pdf = new Pdf('/path/ my.pdf', [
284284 'command' => '/some/other/path/to/pdftk',
285+ // or on most Windows systems:
286+ // 'command' => 'C:\Program Files (x86)\PDFtk\bin\pdftk.exe',
285287 'useExec' => true, // May help on Windows systems if execution fails
286288]);
287289```
0 commit comments