Important

We are updating the images for OroCommerce version 6.1 to align with the latest changes in the back-office design. During this transition, some images may still show older versions. Thank you for your patience as we work to update all visuals to reflect these changes.

Create a PDF File 

The overall chain of generating a PDF file is as follows:

``Start`` -> ``PDF builder factory`` -> Create ``PDF builder`` -> ``PDF builder`` -> Create ``PDF file`` -> ``PDF engine`` -> Create ``PDF file`` -> ``PDF file`` -> ``End``

Example:

$pdfBuilder = $this->pdfBuilderFactory->createPdfBuilder(PdfOptionsPreset::DEFAULT_PRESET);
$pdfTemplate = $this->pdfTemplateFactory->createPdfTemplate(
    '@AcmeDemo/PdfDocument/template.html.twig',
    ['param1' => 'value1', 'param2' => 'value2']
);
$pdfBuilder->content($pdfTemplate);
// Set the page size to A4 format width and height.
$pdfBuilder->setPageWidth('8.27in');
$pdfBuilder->setPageHeight('11.7in');
/* @var $pdfFile \Oro\Bundle\PdfGeneratorBundle\Model\PdfFileInterface */
$pdfFile = $pdfBuilder->createPdfFile();