You may have the possibility to convert Office files into PDF.
123
, 602
, abw
, bib
, bmp
, cdr
, cgm
, cmx
, csv
, cwk
, dbf
, dif
, doc
, docm
,
docx
, dot
, dotm
, dotx
, dxf
, emf
, eps
, epub
, fodg
, fodp
, fods
, fodt
, fopd
,
gif
, htm
, html
, hwp
, jpeg
, jpg
, key
, ltx
, lwp
, mcw
, met
, mml
, mw
, numbers
,
odd
, odg
, odm
, odp
, ods
, odt
, otg
, oth
, otp
, ots
, ott
, pages
, pbm
, pcd
,
pct
, pcx
, pdb
, pdf
, pgm
, png
, pot
, potm
, potx
, ppm
, pps
, ppt
, pptm
, pptx
,
psd
, psw
, pub
, pwp
, pxl
, ras
, rtf
, sda
, sdc
, sdd
, sdp
, sdw
, sgl
, slk
,
smf
, stc
, std
, sti
, stw
, svg
, svm
, swf
, sxc
, sxd
, sxg
, sxi
, sxm
, sxw
,
tga
, tif
, tiff
, txt
, uof
, uop
, uos
, uot
, vdx
, vor
, vsd
, vsdm
, vsdx
, wb2
,
wk1
, wks
, wmf
, wpd
, wpg
, wps
, xbm
, xhtml
, xls
, xlsb
, xlsm
, xlsx
, xlt
, xltm
,
xltx
, xlw
, xml
, xpm
, zabw
Warning
As assets files, by default the office 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->office()
->files('document.txt')
->generate() // will return directly a stream response
;
}
}
You have the possibility to add more than one file, but you will generate a ZIP folder instead of PDF.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document_one.txt', 'document_two.odt')
->generate() // will download a zip file with two PDF files
;
}
}
Default: false
With the merge()
function you can merge multiple office files into a PDF.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document_one.txt', 'document_two.odt')
->merge() // is same as ->merge(true)
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Set the PDF orientation to landscape.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->landscape() // is same as `->landscape(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: All pages generated
Page ranges to print (e.g. '1-5, 8, 11-13'
).
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->nativePageRanges('1-5')
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: true
Set whether to export the form fields or to use the inputted/selected content of the fields.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportFormFields() // is same as `->exportFormFields(false)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Set whether to render the entire spreadsheet as a single page.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->singlePageSheets() // is same as `->singlePageSheets(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
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->office()
->files('document.txt')
->pdfFormat(PdfFormat::Pdf1b)
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
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->office()
->files('document.txt')
->pdfUniversalAccess() // is same as `->pdfUniversalAccess(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
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->office()
->files('document.txt')
->metadata(['Author' => 'SensioLabs', 'Subject' => 'Gotenberg'])
->generate()
;
}
}
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->office()
->files('document.txt')
->addMetadata('key', 'value')
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.