You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating PDF documents, a common requirement is to insert HTML content into specific sections of the document, such as a `TableCell`. This article demonstrates how to achieve this using the RadPdfProcessing and RadWordsProcessing libraries. This knowledge base article also answers the following questions:
14
-
- How can I display HTML content in a PDF document?
15
-
- What is the approach to convert HTML to PDF content for insertion into a PDF table cell?
16
-
- How to use RadWordsProcessing to import HTML content and RadPdfProcessing to insert it into a PDF document?
17
-
18
-
## Environment
19
-
20
-
<table>
21
-
<tbody>
22
-
<tr>
23
-
<td>Product</td>
24
-
<td>
25
-
RadPdfProcessing for Document Processing, <br/>
26
-
RadWordsProcessing for Document Processing
27
-
</td>
28
-
</tr>
29
-
</tbody>
30
-
</table>
19
+
When generating PDF documents, a common requirement is to insert HTML content into specific sections of the document, such as a [TableCell]({%slug radpdfprocessing-editing-tablecell%}). This article demonstrates how to achieve this using the smooth integration between [RadPdfProcessing]({%slug radpdfprocessing-overview%}) and [RadWordsProcessing]({%slug radwordsprocessing-overview%}) libraries.
20
+
21
+
>caption Sample HTML content to Insert
22
+
23
+
```HTML
24
+
<!DOCTYPE html>
25
+
<html>
26
+
<body>
27
+
<p>I am normal</p>
28
+
<pstyle="color:red;">I am red</p>
29
+
<pstyle="color:blue;">I am blue</p>
30
+
<pstyle="font-size:50px;">I am big</p>
31
+
</body>
32
+
</html>
33
+
```
34
+
35
+

31
36
32
37
## Solution
33
-
To insert HTML content into a `TableCell` in a PDF document, you can use the RadWordsProcessing library to import the HTML content and then either convert it to a PDF document or export it as images to insert into the PDF. Below are the steps and code snippet for achieving this.
38
+
To insert HTML content into a `TableCell` in a PDF document, you can obtain the HTML content as an image and insert the image inside the PDF table cell. Below are the steps and complete code snippet for achieving this:
39
+
40
+
1.**Import HTML Content**: Use the RadWordsProcessing's [HtmlFormatProvider]({%slug radwordsprocessing-formats-and-conversion-html-htmlformatprovider%}) to import the HTML content into a [RadFlowDocument]({%slug radwordsprocessing-model-radflowdocument%}).
41
+
42
+
1.**Export the HTML Content to PDF Format**: Use the RadWordsProcessing's [PdfFormatProvider]({%slug radwordsprocessing-formats-and-conversion-pdf-pdfformatprovider%}) to convert the `RadFlowDocument` into PDF format.
43
+
44
+
1.**Convert the exported PDF content to an Image**: Use the RadPdfProcessing's [PdfFormatProvider]({%slug radpdfprocessing-formats-and-conversion-pdf-pdfformatprovider%}) to import the exported HTML content to [RadFixedDocument]({%slug radpdfprocessing-model-radfixeddocument%}) and the [SkiaImageFormatProvider]({%slug radpdfprocessing-formats-and-conversion-image-using-skiaimageformatprovider%}) to export the PDF pages to images.
34
45
35
-
1.**Import HTML Content**: Use RadWordsProcessing's `HtmlFormatProvider` to import the HTML content into a `RadFlowDocument`.
36
-
2.**Export HTML to PDF or Images**: Use RadWordsProcessing's `PdfFormatProvider` to convert the `RadFlowDocument` into PDF format or export it as images.
37
-
3.**Insert PDF or Images into TableCell**: Use RadPdfProcessing to create or edit a PDF document and insert the converted PDF content or images into the desired `TableCell`.
46
+
1.**Insert the exported Images into the PDF TableCell**: Use RadPdfProcessing's [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) to create or edit a PDF document and insert the converted PDF images into the desired [TableCell]({%slug radpdfprocessing-editing-tablecell%}).
-[Importing HTML Content with RadWordsProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/formats-and-conversion/html/htmlformatprovider)
73
-
-[Converting Documents to Images with RadPdfProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/formats-and-conversion/convert-to-image/using-image-format-provider)
74
-
-[Generate Table with Images using RadPdfProcessing](https://docs.telerik.com/devtools/document-processing/knowledge-base/generate-table-with-images-pdf-processing)
138
+
-[Generate Table with Images using RadPdfProcessing]({%slug generate-table-with-images-pdf-processing%})
0 commit comments