Loading...
Searching...
No Matches
HTML2PDF.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------------
2// Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3// Consult legal.txt regarding legal and license information.
4//---------------------------------------------------------------------------------------
5#ifndef PDFTRON_H_CPPPDFHTML2PDF
6#define PDFTRON_H_CPPPDFHTML2PDF
7
8#include <PDF/PDFDoc.h>
9#include <PDF/Print.h>
10#include <C/PDF/TRN_HTML2PDF.h>
11
12namespace pdftron {
13 namespace PDF {
14
15class Proxy;
16class WebPageSettings;
17class TOCSettings;
18
65{
66public:
70
71#ifndef SWIG
90 static bool Convert(PDFDoc& doc, const UString& url);
91
112 static bool Convert(PDFDoc& doc, const UString& url, const WebPageSettings& settings);
113#endif
114
120 void InsertFromURL(const UString& url);
121
129 void InsertFromURL(const UString& url, const WebPageSettings& settings);
130
136 void InsertFromHtmlString(const UString& html);
137
144 void InsertFromHtmlString(const UString& html, const WebPageSettings& settings);
145
150 void InsertTOC();
151
158 void InsertTOC(const TOCSettings& settings);
159
176 bool Convert(PDFDoc& doc);
177
186 int GetHTTPErrorCode() const;
187
195 void SetQuiet(bool quiet);
196
205 void SetCompatibilityMode(bool compatibility);
206
214 void SetSandbox(bool sandbox);
215
221 void SetLogFilePath(const UString& path);
222
229
237 static void SetModulePath(const UString& path);
238
239
245 static bool IsModuleAvailable();
246
251
256
263
272 void SetPaperSize(const UString& width, const UString& height);
273
280 void SetLandscape(bool enable);
281
290 void SetDPI(int dpi);
291
300 void SetOutline(bool enable, int depth = 4);
301
309 void DumpOutline(const UString& xml_file);
310
319 void SetPDFCompression(bool enable);
320
331 void SetMargins(const UString& top, const UString& bottom, const UString& left, const UString& right);
332
338 void SetHeader(const UString& header);
339
345 void SetFooter(const UString& footer);
346
353 void SetImageDPI(int dpi);
354
361 void SetImageQuality(int quality);
362
369 void SetCookieJar(const UString& path);
370
371/* {{codegen: HTML2PDF}} */
372
379 void AddCookie(const UString& name, const UString& value);
380
387 void SetCustomHeader(const UString& name, const UString& value);
388/* {{codegen: HTML2PDF}} */
389
393 void Destroy();
394
395 // @cond PRIVATE_DOC
396
397 #ifndef SWIGHIDDEN
398 TRN_HTML2PDF mp_html2pdf;
399 #endif
400
401private:
402 HTML2PDF(const HTML2PDF&);
403 HTML2PDF& operator= (const HTML2PDF&);
404 // @endcond
405
406};
407
408
414class Proxy
415{
416public:
421
426
435 void SetType(Type type);
436
442 void SetHost(const UString& host);
443
449 void SetPort(int port);
450
456 void SetUsername(const UString& username);
457
463 void SetPassword(const UString& password);
464
468 void Destroy();
469
470 // @cond PRIVATE_DOC
471
472#ifndef SWIGHIDDEN
473 TRN_HTML2PDF_Proxy mp_impl;
474#endif
475 // @endcond
476
477};
478
483{
484public:
489
494
500 void SetPrintBackground(bool background);
501
508 void SetLoadImages(bool load);
509
515 void SetAllowJavaScript(bool enable);
516
524 void SetSmartShrinking(bool enable);
525
532 void SetMinimumFontSize(int size);
533
548 void SetDefaultEncoding(const UString& encoding);
549
557 void SetUserStyleSheet(const UString& url);
558
566 void SetAllowPlugins(bool enable);
567
575 void SetPrintMediaType(bool print);
576
586 void SetIncludeInOutline(bool include);
587
593 void SetUsername(const UString& username);
594
600 void SetPassword(const UString& password);
601
609 void SetJavaScriptDelay(int msec);
610
618 void SetConvertDelay(int msec);
619
626 void SetTimeout(int msec);
627
633 void SetZoom(double zoom);
634
641 void SetBlockLocalFileAccess(bool block);
642
649 void SetStopSlowScripts(bool stop);
650
658 void SetDebugJavaScriptOutput(bool forward);
659
670 e_abort, // Abort the conversion process.
671 e_skip, // Do not add the object to the final output
672 e_ignore // Try to add the object to the final output.
673 };
675
684 void SetExternalLinks(bool convert);
685
693 void SetInternalLinks(bool convert);
694
702 void SetProduceForms(bool forms);
703
709 void SetProxy(const Proxy& proxy);
710
714 void Destroy();
715
716 // @cond PRIVATE_DOC
717
718#ifndef SWIGHIDDEN
719 TRN_HTML2PDF_WebPageSettings mp_impl;
720#endif
721 // @endcond
722
723};
724
731{
732public:
737
742
749 void SetDottedLines(bool enable);
750
758 void SetLinks(bool enable);
759
766 void SetCaptionText(const UString& caption);
767
774 void SetLevelIndentation(int indentation);
775
782 void SetTextSizeShrink(double shrink);
783
792 void SetXsl(const UString& style_sheet);
793
797 void Destroy();
798
799 // @cond PRIVATE_DOC
800
801#ifndef SWIGHIDDEN
802 TRN_HTML2PDF_TOCSettings mp_impl;
803#endif
804 // @endcond
805
806};
807
808 }; // namespace PDF
809}; // namespace pdftron
810
811#include <Impl/HTML2PDF.inl>
812
813#endif // PDFTRON_H_CPPPDFHTML2PDF
void InsertTOC(const TOCSettings &settings)
int GetHTTPErrorCode() const
void InsertFromHtmlString(const UString &html, const WebPageSettings &settings)
void SetDPI(int dpi)
void InsertFromURL(const UString &url)
pdftron::PDF::WebPageSettings WebPageSettings
Definition HTML2PDF.h:68
void SetSandbox(bool sandbox)
void SetHeader(const UString &header)
void InsertFromURL(const UString &url, const WebPageSettings &settings)
void SetFooter(const UString &footer)
static bool Convert(PDFDoc &doc, const UString &url)
void SetOutline(bool enable, int depth=4)
UString GetLog() const
void DumpOutline(const UString &xml_file)
static void SetModulePath(const UString &path)
void SetPDFCompression(bool enable)
void SetQuiet(bool quiet)
void SetCookieJar(const UString &path)
pdftron::PDF::TOCSettings TOCSettings
Definition HTML2PDF.h:69
void SetMargins(const UString &top, const UString &bottom, const UString &left, const UString &right)
void SetPaperSize(const UString &width, const UString &height)
static bool IsModuleAvailable()
bool Convert(PDFDoc &doc)
void AddCookie(const UString &name, const UString &value)
void SetPaperSize(PrinterMode::PaperSize size)
void InsertFromHtmlString(const UString &html)
void SetLogFilePath(const UString &path)
static bool Convert(PDFDoc &doc, const UString &url, const WebPageSettings &settings)
void SetLandscape(bool enable)
void SetCompatibilityMode(bool compatibility)
void SetImageDPI(int dpi)
void SetImageQuality(int quality)
pdftron::PDF::Proxy Proxy
Definition HTML2PDF.h:67
void SetCustomHeader(const UString &name, const UString &value)
void SetHost(const UString &host)
void SetType(Type type)
void SetUsername(const UString &username)
void SetPort(int port)
void SetPassword(const UString &password)
void SetDottedLines(bool enable)
void SetTextSizeShrink(double shrink)
void SetLevelIndentation(int indentation)
void SetXsl(const UString &style_sheet)
void SetCaptionText(const UString &caption)
void SetLinks(bool enable)
void SetUserStyleSheet(const UString &url)
void SetProduceForms(bool forms)
void SetAllowPlugins(bool enable)
void SetStopSlowScripts(bool stop)
void SetIncludeInOutline(bool include)
void SetAllowJavaScript(bool enable)
void SetPassword(const UString &password)
void SetSmartShrinking(bool enable)
void SetUsername(const UString &username)
void SetInternalLinks(bool convert)
void SetDebugJavaScriptOutput(bool forward)
void SetDefaultEncoding(const UString &encoding)
void SetProxy(const Proxy &proxy)
void SetPrintBackground(bool background)
void SetMinimumFontSize(int size)
void SetPrintMediaType(bool print)
void SetJavaScriptDelay(int msec)
void SetExternalLinks(bool convert)
void SetLoadErrorHandling(ErrorHandling type)
void SetBlockLocalFileAccess(bool block)