Skip to content

Latest commit

 

History

History
92 lines (70 loc) · 2.25 KB

convert-builder.md

File metadata and controls

92 lines (70 loc) · 2.25 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()
             ;
        }
    }

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()
             ;
        }
    }

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()
             ;
        }
    }