fix(pdf-download): avoid empty abstract in PDF output
Added conditional check to ensure the abstract is only included in the PDF if it exists. This prevents empty or malformed sections when post excerpts are not provided, improving the readability and quality of the generated PDF documents.
This commit is contained in:
parent
4de71503e8
commit
5522a4599e
1 changed files with 6 additions and 4 deletions
|
@ -885,10 +885,12 @@ function handle_pdf_download()
|
|||
}
|
||||
|
||||
// Set abstract
|
||||
$pdf->Ln(10);
|
||||
$pdf->SetFont('helvetica', '', 12);
|
||||
$pdf->setTextColor(128);
|
||||
$pdf->writeHTML("<b>Abstract:</b> " . $post->post_excerpt);
|
||||
if ($post->post_excerpt) {
|
||||
$pdf->Ln(10);
|
||||
$pdf->SetFont('helvetica', '', 12);
|
||||
$pdf->setTextColor(128);
|
||||
$pdf->writeHTML("<b>Abstract:</b> " . $post->post_excerpt);
|
||||
}
|
||||
|
||||
// Set content
|
||||
$pdf->setTextColor(0);
|
||||
|
|
Loading…
Reference in a new issue