Skip to content

Latest commit

 

History

History
146 lines (115 loc) · 3.21 KB

merge-builder.md

File metadata and controls

146 lines (115 loc) · 3.21 KB

Merge Builder

You may have the possibility to merge several PDF document.

Basic usage

Warning

As assets files, by default the PDF files are fetch in the assets folder of your application.
For more information about path resolution go to assets documentation.

namespace App\Controller;

use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;

class YourController
{
    public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
    {
        return $gotenberg->merge()
            ->files(
                'document.pdf',
                'document_2.pdf',
            )
            ->generate()
            ->stream()
         ;
    }
}

Tip

For more information go to Gotenberg documentations.

pdfFormat

Default: None

Convert the resulting PDF into the given PDF/A format.

namespace App\Controller;

use Sensiolabs\GotenbergBundle\Enum\PdfFormat;use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;

class YourController
{
    public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
    {
        return $gotenberg->merge()
           ->files(
                'document.pdf',
                'document_2.pdf',
            )
            ->pdfFormat(PdfFormat::Pdf1b)
            ->generate()
            ->stream()
         ;
    }
}

pdfUniversalAccess

Default: false

Enable PDF for Universal Access for optimal accessibility.

namespace App\Controller;

use Sensiolabs\GotenbergBundle\Enum\PdfFormat;use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;

class YourController
{
    public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
    {
        return $gotenberg->merge()
           ->files(
                'document.pdf',
                'document_2.pdf',
            )
            ->pdfUniversalAccess() // is same as `->pdfUniversalAccess(true)`
            ->generate()
            ->stream()
         ;
    }
}

metatada

Default: None

Resets the configuration metadata and add new ones to write.

namespace App\Controller;

use Sensiolabs\GotenbergBundle\Enum\PdfFormat;use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;

class YourController
{
    public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
    {
        return $gotenberg->merge()
           ->files(
                'document.pdf',
                'document_2.pdf',
            )
            ->metadata(['Author' => 'SensioLabs', 'Subject' => 'Gotenberg'])
            ->generate()
            ->stream()
         ;
    }
}

addMetadata

Default: None

If you want to add metadata from the ones already loaded in the configuration.

namespace App\Controller;

use Sensiolabs\GotenbergBundle\Enum\PdfFormat;use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;

class YourController
{
    public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
    {
        return $gotenberg->merge()
           ->files(
                'document.pdf',
                'document_2.pdf',
            )
            ->addMetadata('key', 'value')
            ->generate()
            ->stream()
         ;
    }
}