mikehaertl\pdftk\Pdf::cat PHP Method

cat() public method

Values for rotation are (in degrees): north: 0, east: 90, south: 180, west: 270, left: -90, right: +90, down: +180. left, right and down make relative adjustments to a page's rotation. Note: Older pdftk versions use N, E, S, W, L, R, and D instead. Example: $pdf = new Pdf; $pdf->addFile('file1.pdf', 'A') ->addFile('file2.pdf', 'B') ->cat(array(1,3),'B')) // pages 1 and 3 of file B ->cat(1, 5, 'A', 'odd') // pages 1, 3, 5 of file A ->cat('end', 5, 'B') // pages 5 to end of file B in reverse order ->cat(null, null, 'B', 'east') // All pages from file B rotated by 90 degree ->saveAs('out.pdf');
public cat ( integer | string | array $start, integer | string | null $end = null, string | null $handle = null, string | null $qualifier = null, string $rotation = null ) : Pdf
$start integer | string | array the start page number or an array of page numbers. If an array, the other arguments will be ignored. $start can also be bigger than $end for pages in reverse order.
$end integer | string | null the end page number or null for single page (or list if $start is an array)
$handle string | null the handle of the file to use. Can be null if only a single file was added.
$qualifier string | null the page number qualifier, either 'even' or 'odd' or null for none
$rotation string the rotation to apply to the pages.
return Pdf the pdf instance for method chaining
    public function cat($start, $end = null, $handle = null, $qualifier = null, $rotation = null)
    {
        $this->getCommand()->setOperation('cat')->addPageRange($start, $end, $handle, $qualifier, $rotation);
        return $this;
    }

Usage Example

Exemplo n.º 1
1
 public function dosplit(Request $request)
 {
     $print_element = Element::where('subject_lesson_id', $request->subject_lesson_id)->where('title', 'نسخة للطباعة')->first();
     if (!$print_element) {
         $print_element = new Element();
         $print_element->title = 'نسخة للطباعة';
         $print_element->element_order = 10;
         $print_element->state = 'نشط';
         $print_element->type = 'pdf';
         $print_element->subject_lesson_id = $request->subject_lesson_id;
         $print_element->file = $request->file('file');
         $print_element->save();
     }
     foreach ($request->subject_element_title as $key => $value) {
         if ($request->element_start_page[$key]) {
             $elelment = new Element();
             $fonly = uniqid() . time() . '.pdf';
             $filename = public_path() . '/temp/' . $fonly;
             $elelment->title = $value;
             $elelment->element_order = $request->element_order[$key];
             $elelment->state = 'نشط';
             $elelment->type = 'pdf';
             $elelment->subject_lesson_id = $request->subject_lesson_id;
             $pdf = new Pdf($print_element->file->path());
             $pdf->cat($request->element_start_page[$key], $request->element_end_page[$key]);
             $pdf->saveAs($filename);
             // sleep(8);
             $elelment->file = $filename;
             // $elelment->file = 'https://el-css.edu.om/admin/public/temp/'.$fonly;
             $elelment->save();
         }
     }
     $message = 'تم اضافة العناصر بنجاح';
     return redirect()->route('s.elements.index', array('id' => $request->subject_lesson_id))->with('success', $message);
 }
All Usage Examples Of mikehaertl\pdftk\Pdf::cat