eDocEngine VCL
Create documents and reports in 18 formats
Compatibility
Delphi C++Builder

How to export HTML content to PDF format in Delphi

Using eDocEngine and THTMLViewer.

There is already an article explaining how to export from THTMLViewer using eDocEngine. However, it tried to solve a bit more complicated problem (for a customer who wanted to export from XML to PDF) and is hence a bit convoluted. It applies an XSL stylesheet to XML data, generates a HTML page and then exports it to PDF.

Here is a more straight-forward version. The THTMLViewer component is from http://www.songbeamer.com/delphi/, who provided an updated version of David Baldwin's HTML Display Components (ThtmlViewer, TFrameViewer, and TFrameBrowser). A copy of it is also shipped with eDocEngine.

In this video, the THTMLViewer package is installed from source and then used in a VCL Forms application project to export a HTML page to PDF.

Here is the code. It convert a HTML document found in the RAD Studio folder. Please note that THTMLViewer can display only simple documents.

procedure TForm1.Button1Click(Sender: TObject);
begin
  // gtHtmlViewInterface1.Engine := gtPDFEngine1; // or any other engine
  gtPDFEngine1.FileName := 'html_export.pdf';
  gtHtmlViewInterface1.RenderDocument(HTMLViewer1);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  HTMLViewer1.LoadFromFile('C:\Program Files\Embarcadero\RAD Studio\12.0\deploy_en.htm');
end;

---o0O0o---

Our .NET Developer Tools
XtremeDocumentStudio .NET

Multi-format document-processing component suite for .NET developers.

PDFOne .NET

A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.

Our Delphi/C++Builder developer tools
XtremeDocumentStudio Delphi

Multi-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms.

eDocEngine VCL

A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.

PDFtoolkit VCL

A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.

Our Java developer tools
XtremeDocumentStudio (for Java)

Multi-format document-processing component suite for Java developers.

PDFOne (for Java)

A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications.

Our Platform-Agnostic Cloud and On-Premises APIs
StarDocs

Cloud-hosted and On-Premises REST-based document-processing and document-viewing APIs

Privacy | Legal | Feedback | Newsletter | Blog | Resellers © 2002-2017 Gnostice Information Technologies Private Limited. All rights reserved.