Skip to content

Latest commit

 

History

History
95 lines (73 loc) · 2.13 KB

convert-builder.md

File metadata and controls

95 lines (73 loc) · 2.13 KB

Convert Builder

You may have the possibility to convert 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.

Warning

If you provide multiple PDF files you will get ZIP folder containing all the converted PDF.

namespace App\Controller;

use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;

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