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()
->stream() // 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()
->stream() // will download a zip file with two PDF files
;
}
}
merge
landscape
nativePageRanges
singlePageSheets
skipEmptyPages
losslessImageCompression
quality
reduceImageResolution
maxImageResolution
splitMode
splitSpan
splitUnify
doNotExportFormFields
allowDuplicateFieldNames
doNotExportBookmarks
exportBookmarksToPdfDestination
exportPlaceholders
exportNotes
exportNotesPages
exportOnlyNotesPages
exportNotesInMargin
exportLinksRelativeFsys
exportHiddenSlides
addOriginalDocumentAsStream
download from
metadata
addMetadata
pdfFormat
pdfUniversalAccess
convertOooTargetToPdfTarget
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()
->stream()
;
}
}
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()
->stream()
;
}
}
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()
->stream()
;
}
}
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()
->stream()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify that automatically inserted empty pages are suppressed. This option is active only if storing Writer documents.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->skipEmptyPages() // is same as `->skipEmptyPages(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify if images are exported to PDF using a lossless compression format like PNG or compressed using the JPEG format.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->losslessImageCompression() // is same as `->losslessImageCompression(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: 90
Specify the quality of the JPG export. A higher value produces a higher-quality image and a larger file. Between 1 and 100.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->quality(75)
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify if the resolution of each image is reduced to the resolution specified by the form field maxImageResolution.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->reduceImageResolution() // is same as `->reduceImageResolution(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: 300
If the form field reduceImageResolution is set to true, tell if all images will be reduced to the given value in DPI. Possible values are: 75, 150, 300, 600 and 1200.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\Enumeration\ImageResolutionDPI;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->maxImageResolution(ImageResolutionDPI::DPI300)
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
default: None
Either intervals
or pages
.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\Enum\SplitMode;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->splitMode(SplitMode::Intervals)
->splitSpan('1')
->generate()
->stream()
;
}
}
Tip
For more information go to Gotenberg documentations.
default: None
Either the intervals or the page ranges to extract, depending on the selected splitMode
.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\Enumeration\SplitMode;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->splitMode(SplitMode::Intervals)
->splitSpan('1')
->generate()
->stream()
;
}
}
Default: false
Specify whether to put extracted pages into a single file or as many files as
there are page ranges. Only works with pages
mode.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\Enum\SplitMode;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->splitMode(SplitMode::Pages)
->splitSpan('1-2')
->splitUnify() // is same as ->splitUnify(true)
->generate()
->stream()
;
}
}
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')
->doNotExportFormFields() // is same as `->doNotExportFormFields(false)`
->generate()
->stream()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify whether multiple form fields exported are allowed to have the same field name.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->allowDuplicateFieldNames() // is same as `->allowDuplicateFieldNames(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: true
Specify if bookmarks are exported to PDF.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->doNotExportBookmarks() // is same as `->doNotExportBookmarks(false)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify that the bookmarks contained in the source LibreOffice file should be exported to the PDF file as Named Destination.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportBookmarksToPdfDestination() // is same as `->exportBookmarksToPdfDestination(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Export the placeholders fields visual markings only. The exported placeholder is ineffective.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportPlaceholders() // is same as `->exportPlaceholders(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify if notes are exported to PDF.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportNotes() // is same as `->exportNotes(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify if notes pages are exported to PDF. Notes pages are available in Impress documents only.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportNotesPages() // is same as `->exportNotesPages(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify, if the form field exportNotesPages is set to true, if only notes pages are exported to PDF.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportOnlyNotesPages() // is same as `->exportOnlyNotesPages(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify if notes in margin are exported to PDF.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportNotesInMargin() // is same as `->exportNotesInMargin(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify that the file system related hyperlinks (file:// protocol) present in the document will be exported as relative to the source document location.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportLinksRelativeFsys() // is same as `->exportLinksRelativeFsys(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
exportHiddenSlides
Default: false
Export, for LibreOffice Impress, slides that are not included in slide shows.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->exportHiddenSlides() // is same as `->exportHiddenSlides(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify that a stream is inserted to the PDF file which contains the original document for archiving purposes.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->addOriginalDocumentAsStream() // is same as `->addOriginalDocumentAsStream(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Warning
URL of the file. It MUST return a Content-Disposition
header with a filename parameter.
To download files resource from URLs.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg
->office()
->downloadFrom([
[
'url' => 'http://url/to/file.com',
'extraHttpHeaders' =>
[
'MyHeader' => 'MyValue',
],
],
[
'url' => 'http://url/to/file.com',
'extraHttpHeaders' =>
[
'MyHeaderOne' => 'MyValue',
'MyHeaderTwo' => 'MyValue',
],
],
])
->generate()
->stream()
;
}
}
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()
->stream()
;
}
}
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()
->stream()
;
}
}
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()
->stream()
;
}
}
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()
->stream()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: false
Specify that the target documents with .od[tpgs] extension, will have that extension changed to .pdf when the link is exported to PDF. The source document remains untouched.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->convertOooTargetToPdfTarget() // is same as `->convertOooTargetToPdfTarget(true)`
->generate()
;
}
}
Tip
For more information go to Gotenberg documentations.
Default: None
Set the password for opening the source file.
namespace App\Controller;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
class YourController
{
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->office()
->files('document.txt')
->password('My password')
->generate()
->stream()
;
}
}