Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
WriteHTML example
'margin_left' =>
$this
->_document
[
'left'
]
,
'margin_right' =>
$this
->_document
[
'right'
]
,
'margin_top' =>
$this
->_document
[
'top'
]
,
'margin_bottom' =>
$this
->_document
[
'bottom'
]
,
]
)
;
if
(
$this
->_preview == true || !
$this
->_documentHash
)
{
$mpdf
=
new
Mpdf
(
$mpdfConfig
)
;
$mpdf
->
setLogger
(
Shopware
(
)
->
Container
(
)
->
get
(
'corelogger'
)
)
;
$mpdf
->
WriteHTML
(
$html
)
;
$mpdf
->
Output
(
)
;
exit
;
}
$tmpFile
=
tempnam
(
sys_get_temp_dir
(
)
, 'document'
)
;
$mpdf
=
new
Mpdf
(
$mpdfConfig
)
;
$mpdf
->
setLogger
(
Shopware
(
)
->
Container
(
)
->
get
(
'corelogger'
)
)
;
$mpdf
->
WriteHTML
(
$html
)
;
$mpdf
->
Output
(
$tmpFile
, 'F'
)
;
'sepaCompany' =>
Shopware
(
)
->
Config
(
)
->
get
(
'sepaCompany'
)
,
'sepaHeaderText' =>
Shopware
(
)
->
Config
(
)
->
get
(
'sepaHeaderText'
)
,
'sepaSellerId' =>
Shopware
(
)
->
Config
(
)
->
get
(
'sepaSellerId'
)
,
]
)
;
Shopware
(
)
->
Template
(
)
->
addTemplateDir
(
__DIR__ . '/../Views/'
)
;
$data
=
Shopware
(
)
->
Template
(
)
->
fetch
(
'frontend/plugins/sepa/email.tpl'
)
;
/** @var array<string, string> $mpdfConfig */
$mpdfConfig
=
Shopware
(
)
->
Container
(
)
->
getParameter
(
'shopware.mpdf.defaultConfig'
)
;
$mpdf
=
new
Mpdf
(
$mpdfConfig
)
;
$mpdf
->
WriteHTML
(
$data
)
;
$pdfFileContent
=
$mpdf
->
Output
(
'', 'S'
)
;
if
(
$pdfFileContent
=== false
)
{
throw
new
Enlight_Exception
(
'Could not generate SEPA attachment file'
)
;
}
$attachmentName
= 'SEPA_' .
$orderNumber
;
$mail
->
createAttachment
(
$pdfFileContent
,
'application/pdf',