All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HTML2PDF.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2018 by PDFTron Systems 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 
12 namespace pdftron {
13  namespace PDF {
14 
60 class HTML2PDF
61 {
62 public:
68  class Proxy
69  {
70  public:
74  Proxy();
75 
79  ~Proxy();
80 
89  void SetType(Type type);
90 
96  void SetHost(const UString& host);
97 
103  void SetPort(int port);
104 
110  void SetUsername(const UString& username);
111 
117  void SetPassword(const UString& password);
118 
122  void Destroy();
123 
125  #ifndef SWIGHIDDEN
126  TRN_HTML2PDF_Proxy mp_impl;
127  #endif
128  };
130 
135  {
136  public:
140  WebPageSettings();
141 
146 
152  void SetPrintBackground(bool background);
153 
159  void SetLoadImages(bool load);
160 
166  void SetAllowJavaScript(bool enable);
167 
174  void SetSmartShrinking(bool enable);
175 
181  void SetMinimumFontSize(int size);
182 
196  void SetDefaultEncoding(const UString& encoding);
197 
204  void SetUserStyleSheet(const UString& url);
205 
212  void SetAllowPlugins(bool enable);
213 
220  void SetPrintMediaType(bool print);
221 
230  void SetIncludeInOutline(bool include);
231 
237  void SetUsername(const UString& username);
238 
244  void SetPassword(const UString& password);
245 
253  void SetJavaScriptDelay(int msec);
254 
260  void SetZoom(double zoom);
261 
267  void SetBlockLocalFileAccess(bool block);
268 
274  void SetStopSlowScripts(bool stop);
275 
282  void SetDebugJavaScriptOutput(bool forward);
283 
293  e_abort, // Abort the conversion process.
294  e_skip, // Do not add the object to the final output
295  e_ignore // Try to add the object to the final output.
296  };
298 
306  void SetExternalLinks(bool convert);
307 
314  void SetInternalLinks(bool convert);
315 
322  void SetProduceForms(bool forms);
323 
329  void SetProxy(const Proxy& proxy);
330 
334  void Destroy();
335 
337  #ifndef SWIGHIDDEN
338  TRN_HTML2PDF_WebPageSettings mp_impl;
339  #endif
340  };
342 
347  {
348  public:
352  TOCSettings();
353 
357  ~TOCSettings();
358 
364  void SetDottedLines(bool enable);
365 
372  void SetLinks(bool enable);
373 
379  void SetCaptionText(const UString& caption);
380 
386  void SetLevelIndentation(int indentation);
387 
393  void SetTextSizeShrink(double shrink);
394 
402  void SetXsl(const UString& style_sheet);
403 
407  void Destroy();
408 
410  #ifndef SWIGHIDDEN
411  TRN_HTML2PDF_TOCSettings mp_impl;
412  #endif
413  };
415 
416 #ifndef SWIG
417 
435  static bool Convert(PDFDoc& doc, const UString& url);
436 
457  static bool Convert(PDFDoc& doc, const UString& url, const WebPageSettings& settings);
458 #endif
459 
465  void InsertFromURL(const UString& url);
466 
474  void InsertFromURL(const UString& url, const WebPageSettings& settings);
475 
481  void InsertFromHtmlString(const UString& html);
482 
489  void InsertFromHtmlString(const UString& html, const WebPageSettings& settings);
490 
494  void InsertTOC();
495 
501  void InsertTOC(const TOCSettings& settings);
502 
519  bool Convert(PDFDoc& doc);
520 
529  int GetHTTPErrorCode() const;
530 
538  void SetQuiet(bool quiet);
539 
545  UString GetLog() const;
546 
554  static void SetModulePath(const UString& path);
555 
559  HTML2PDF();
560 
564  ~HTML2PDF();
565 
572 
581  void SetPaperSize(const UString& width, const UString& height);
582 
589  void SetLandscape(bool enable);
590 
599  void SetDPI(int dpi);
600 
608  void SetOutline(bool enable, int depth = 4);
609 
616  void DumpOutline(const UString& xml_file);
617 
624  void SetPDFCompression(bool enable);
625 
636  void SetMargins(const UString& top, const UString& bottom, const UString& left, const UString& right);
637 
643  void SetImageDPI(int dpi);
644 
650  void SetImageQuality(int quality);
651 
657  void SetCookieJar(const UString& path);
658 
662  void Destroy();
663 
665  #ifndef SWIGHIDDEN
666  TRN_HTML2PDF mp_html2pdf;
667  #endif
668 
669 private:
670  HTML2PDF(const HTML2PDF&);
671  HTML2PDF& operator= (const HTML2PDF&);
673 };
674 
675  }; // namespace PDF
676 }; // namespace pdftron
677 
678 
679 #include <Impl/HTML2PDF.inl>
680 
681 #endif // PDFTRON_H_CPPPDFHTML2PDF
void SetCookieJar(const UString &path)
void SetMargins(const UString &top, const UString &bottom, const UString &left, const UString &right)
void SetHost(const UString &host)
int GetHTTPErrorCode() const
void InsertFromURL(const UString &url)
void SetImageQuality(int quality)
void DumpOutline(const UString &xml_file)
void SetDefaultEncoding(const UString &encoding)
void SetPrintBackground(bool background)
void SetPDFCompression(bool enable)
void SetImageDPI(int dpi)
void SetPassword(const UString &password)
void SetPassword(const UString &password)
void SetQuiet(bool quiet)
void SetUsername(const UString &username)
UString GetLog() const
void SetProxy(const Proxy &proxy)
void SetOutline(bool enable, int depth=4)
void SetLevelIndentation(int indentation)
void SetPaperSize(PrinterMode::PaperSize size)
static void SetModulePath(const UString &path)
void SetXsl(const UString &style_sheet)
void SetLoadErrorHandling(ErrorHandling type)
void SetUserStyleSheet(const UString &url)
void SetDPI(int dpi)
void InsertFromHtmlString(const UString &html)
void SetLandscape(bool enable)
static bool Convert(PDFDoc &doc, const UString &url)
void SetTextSizeShrink(double shrink)
void SetUsername(const UString &username)
void SetCaptionText(const UString &caption)

© 2002-2014 PDFTron Systems Inc.