Resolve email PDFs not generating header.
This commit is contained in:
@@ -139,7 +139,9 @@ export function EmailOverlayComponent({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Divider>{t("emails.labels.preview")}</Divider>
|
<Divider>{t("emails.labels.preview")}</Divider>
|
||||||
<strong>{t("emails.labels.pdfcopywillbeattached")}</strong>
|
{bodyshop.attach_pdf_to_email && (
|
||||||
|
<strong>{t("emails.labels.pdfcopywillbeattached")}</strong>
|
||||||
|
)}
|
||||||
|
|
||||||
<Form.Item shouldUpdate>
|
<Form.Item shouldUpdate>
|
||||||
{() => {
|
{() => {
|
||||||
|
|||||||
@@ -80,8 +80,30 @@ export default async function RenderTemplate(
|
|||||||
} else {
|
} else {
|
||||||
let pdf;
|
let pdf;
|
||||||
if (bodyshop.attach_pdf_to_email) {
|
if (bodyshop.attach_pdf_to_email) {
|
||||||
const pdfRequest = _.cloneDeep(reportRequest);
|
const pdfRequest = _.cloneDeep(reportRequest); //Updates to spread in the header details.
|
||||||
pdfRequest.template.recipe = "chrome-pdf";
|
pdfRequest.template = {
|
||||||
|
...pdfRequest.template,
|
||||||
|
...{
|
||||||
|
recipe: "chrome-pdf",
|
||||||
|
...(!ignoreCustomMargins && {
|
||||||
|
chrome: {
|
||||||
|
marginTop:
|
||||||
|
bodyshop.logo_img_path &&
|
||||||
|
bodyshop.logo_img_path.headerMargin &&
|
||||||
|
bodyshop.logo_img_path.headerMargin > 36
|
||||||
|
? bodyshop.logo_img_path.headerMargin
|
||||||
|
: "36px",
|
||||||
|
marginBottom:
|
||||||
|
bodyshop.logo_img_path &&
|
||||||
|
bodyshop.logo_img_path.footerMargin &&
|
||||||
|
bodyshop.logo_img_path.footerMargin > 50
|
||||||
|
? bodyshop.logo_img_path.footerMargin
|
||||||
|
: "50px",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
console.log("PDFREQ", pdfRequest);
|
||||||
const pdfRender = await jsreport.renderAsync(pdfRequest);
|
const pdfRender = await jsreport.renderAsync(pdfRequest);
|
||||||
pdf = pdfRender.toDataURI();
|
pdf = pdfRender.toDataURI();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user