diff --git a/docs/topics/reading-and-writing-to-file.md b/docs/topics/reading-and-writing-to-file.md
index 8f92e1f2..abd7c5f3 100644
--- a/docs/topics/reading-and-writing-to-file.md
+++ b/docs/topics/reading-and-writing-to-file.md
@@ -693,7 +693,7 @@ $sty = $writer->generateStyles(false); // do not write
$newstyle = <<
$sty
-html {
+body {
background-color: yellow;
}
@@ -703,6 +703,31 @@ echo $writer->generateSheetData();
echo $writer->generateHTMLFooter();
```
+#### Editing HTML During Save Via a Callback
+
+You can also add a callback function to edit the generated html
+before saving. For example, you could add a webfont
+(not currently supported for Pdf) as follows:
+
+``` php
+function webfont(string $html): string
+{
+ $linktag = <<
+
+EOF;
+ $html = preg_replace('@
+
+EOF;
+
+ return preg_replace('@@', "$newstyle", $html);
+}
+
+$helper->log('Write to Dompdf');
+$writer = new Dompdf($spreadsheet);
+$filename = $helper->getFileName('21a_Pdf_dompdf.xlsx', 'pdf');
+$writer->setEditHtmlCallback('yellowBody');
+$writer->save($filename);
+
+$helper->log('Write to Mpdf');
+$writer = new Mpdf($spreadsheet);
+$filename = $helper->getFileName('21a_Pdf_mpdf.xlsx', 'pdf');
+$writer->setEditHtmlCallback('yellowBody');
+$writer->save($filename);
+
+$helper->log('Write to Tcpdf');
+$writer = new Tcpdf($spreadsheet);
+$filename = $helper->getFileName('21a_Pdf_tcpdf.xlsx', 'pdf');
+$writer->setEditHtmlCallback('yellowBody');
+$writer->save($filename);
diff --git a/samples/Pdf/21b_Pdf.php b/samples/Pdf/21b_Pdf.php
new file mode 100644
index 00000000..142fc344
--- /dev/null
+++ b/samples/Pdf/21b_Pdf.php
@@ -0,0 +1,51 @@
+.*