G
G
GrimJack2017-06-15 12:27:39
PHP
GrimJack, 2017-06-15 12:27:39

What libraries do you know for overlaying data on pdf forms?

There is a task - to overlay data (text (they have their own font properties, etc.) and pictures) on pdf forms (they can be more than 1 page). The setasign/fpdi and setasign/fpdf (php) libraries are currently used. But it doesn't work with pixels (that's where the data comes in) and has issues with overlaying on more than one page. Using the library house and marking up the pdf form as a background image is also not an option, because it's a crutch.
Perhaps someone has come across this problem more deeply.
The system is written in a mixture of Angular and Laravel. Therefore, in principle, options are suitable for both php and js. But php is in priority

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Tamat, 2017-06-15
@YokiToki

You can try this here.

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use ZendPdf\PdfDocument;
use ZendPdf\Font;
use ZendPdf\Page;

class PDFController extends Controller
{

    public function getDocument() {
        $filename = "sample.pdf";

        // $pdf = PdfDocument::load("path/to/file.pdf");
        $pdf = new PdfDocument();

        // $font = Font::fontWithPath('Courier.ttf');
        $font = Font::fontWithName('Courier');

        $pdfPage = new Page(Page::SIZE_A4);
        $pdfPage->setFont($font, 24);
        $pdfPage->drawText('ZendPDF Laravel 5', 100, 800, 'UTF-8');

        $pdf->pages[] = $pdfPage;
        $pdf->save($filename);

        return \Response::make($pdf->render(), 200, [
            'Content-Type' => 'application/pdf',
            'Content-Disposition' => 'inline; filename="' . $filename . '"'
        ]);
    }

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question