All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Convert.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_CPPPDFConvert
6 #define PDFTRON_H_CPPPDFConvert
7 
8 #include <PDF/PDFDoc.h>
9 #include <PDF/Page.h>
10 #include <PDF/PDFRasterizer.h>
11 #include <PDF/DocumentConversion.h>
12 #include <PDF/WordToPDFOptions.h>
13 #include <C/PDF/TRN_Convert.h>
14 #include <SDF/Obj.h>
15 #include <SDF/ObjSet.h>
16 
17 namespace pdftron{
18  namespace PDF {
19 
21 // Experimental - Developer use only
23 {
24 public:
25  bool Next();
26  bool Ready();
27  UInt32 Progress();
30  void Destroy();
34 
38  operator bool () { return mp_impl!=0;}
39 #ifndef SWIGHIDDEN
40  TRN_ConversionMonitor mp_impl;
41  ConversionMonitor(TRN_ConversionMonitor impl, bool is_owner);
42  bool m_owner;
43 #endif
44 };
46 
90 class Convert
91 {
92 public:
104  };
105 
106  enum FlattenFlag {
124  };
125 
135  static void FromXps(PDFDoc & in_pdfdoc, const UString & in_filename);
136 
148  static void FromXps(PDFDoc & in_pdfdoc, const char* buf, size_t buf_sz);
149 
160  static void FromEmf(PDFDoc & in_pdfdoc, const UString & in_filename);
161 
186  static void FromText(PDFDoc & in_pdfdoc, const UString& in_filename, const SDF::Obj& in_options = SDF::Obj());
187 
197  static void ToEmf(PDFDoc & in_pdfdoc, const UString & in_filename);
198 
208  static void ToEmf(Page & in_page, const UString & in_filename);
209 
214  {
215  public:
216 
221 
226  void SetEmbedImages(bool embed_images);
227 
232  void SetNoFonts(bool no_fonts);
233 
239  void SetSvgFonts(bool svg_fonts);
240 
247  void SetEmbedFonts(bool embed_fonts);
248 
253  void SetNoUnicode(bool no_unicode);
254 
259  void SetIndividualCharPlacement(bool individual_char_placement);
260 
265  void SetRemoveCharPlacement(bool remove_char_placement);
266 
273  void SetFlattenContent(enum FlattenFlag flatten);
274 
280  void SetFlattenThreshold(enum FlattenThresholdFlag threshold);
281 
287  void SetFlattenDPI(UInt32 dpi);
288 
297  void SetFlattenMaximumImagePixels(UInt32 max_pixels);
298 
303  void SetCompress(bool svgz);
304 
309  void SetOutputThumbnails(bool include_thumbs);
310 
316  void SetThumbnailSize(UInt32 size);
317 
322  void SetCreateXmlWrapper(bool xml);
323 
328  void SetDtd(bool dtd);
329 
334  void SetAnnots(bool annots);
335 
345  protected:
346  TRN_Obj m_obj;
347  friend class Convert;
349  };
350 
360  static void ToSvg(PDFDoc & in_pdfdoc, const UString & in_filename, const SVGOutputOptions& in_options = SVGOutputOptions());
361 
371  static void ToSvg(Page & in_page, const UString & in_filename, const SVGOutputOptions& in_options = SVGOutputOptions());
372 
377  {
378  public:
387  void SetPrintMode(bool print_mode);
388 
393  void SetDPI(UInt32 dpi);
394 
399  void SetRenderPages(bool render);
400 
405  void SetThickenLines(bool thicken);
406 
412  void GenerateURLLinks(bool generate);
413 
415  {
416  e_op_off = 0,
419  };
420 
429  void SetOverprint(enum OverprintPreviewMode mode);
430 
431  TRN_Obj Getm_obj();
432 
433  TRN_Obj m_obj;
434  protected:
435  friend class Convert;
437  };
438 
443  {
444  public:
449  void SetOpenXps(bool openxps);
450  };
451 
456  {
457  public:
458 
460  e_internal_xfdf, // include the annotation file in the XOD output. This is the default option
461  e_external_xfdf, // output the annotation file externally to the same output path with extension .xfdf.
462  // This is not available when using streaming conversion
463  e_flatten // flatten all annotations that are not link annotations
464  };
465 
470  void SetOutputThumbnails(bool include_thumbs);
471 
478  void SetThumbnailSize(UInt32 size);
479 
487  void SetThumbnailSize(UInt32 regular_size, UInt32 large_size);
488 
494  void SetElementLimit(UInt32 element_limit);
495 
502  void SetOpacityMaskWorkaround(bool opacity_render);
503 
512  void SetMaximumImagePixels(UInt32 max_pixels);
513 
520  void SetFlattenContent(enum FlattenFlag flatten);
521 
527  void SetFlattenThreshold(enum FlattenThresholdFlag threshold);
528 
534  void SetPreferJPG(bool prefer_jpg);
535 
540  void SetJPGQuality(UInt32 quality);
541 
547  void SetSilverlightTextWorkaround(bool workaround);
548 
553  void SetAnnotationOutput(enum AnnotationOutputFlag annot_output);
554 
560  void SetExternalParts(bool generate);
561 
567  void SetEncryptPassword(const char* pass);
568 
576  void UseSilverlightFlashCompatible(bool compatible);
577  };
578 
583  {
584  public:
589 
594  void SetPreferJPG(bool prefer_jpg);
595 
600  void SetJPGQuality(UInt32 quality);
601 
607  void SetDPI(UInt32 dpi);
608 
617  void SetMaximumImagePixels(UInt32 max_pixels);
618 
623  void SetReflow(bool reflow);
624 
629  void SetScale(double scale);
630 
635  void SetExternalLinks(bool enable);
636 
641  void SetInternalLinks(bool enable);
642 
647  void SetSimplifyText(bool enable);
648 
653  void SetReportFile(const UString& path);
654 
655  protected:
656  TRN_Obj m_obj;
657  friend class Convert;
659  };
660 
665  {
666  public:
671 
676  void SetExpanded(bool expanded);
677 
684  void SetReuseCover(bool reuse);
685  protected:
686  TRN_Obj m_obj;
687  friend class Convert;
689  };
690 
695  {
696  public:
701 
708  void SetBox(enum Page::Box type);
709 
716  void SetRotate(enum Page::Rotate rotation);
717 
723  void SetClip(double x1, double y1, double x2, double y2);
724 
729  void SetPages(const char* page_desc);
730 
740 
746  void SetCMYK(bool enable);
747 
754  void SetDither(bool enable);
755 
762  void SetGray(bool enable);
763 
773  void SetMono(bool enable);
774 
781  void SetAnnots(bool enable);
782 
787  void SetSmooth(bool enable);
788 
797  void SetPrintmode(bool enable);
798 
810  void SetTransparentPage(bool enable);
811 
812 
818  void SetPalettized(bool enable);
819 
826  void SetDPI(double dpi);
827 
839  void SetGamma(double gamma);
840 
844  void SetHRes(int hres);
845 
849  void SetVRes(int vres);
850 
851 
852  protected:
853  TRN_Obj m_obj;
854  friend class Convert;
856  };
857 
870  static void ToXps(PDFDoc & in_pdfdoc, const UString & in_filename, const XPSOutputOptions& options = XPSOutputOptions());
871 
888  static void ToXps(const UString & in_inputFilename, const UString & in_outputFilename, const XPSOutputOptions& options = XPSOutputOptions());
889 
906  static void ToXod(const UString & in_filename, const UString & out_filename, const XODOutputOptions& options = XODOutputOptions());
907 
922  static void ToXod(PDFDoc & in_pdfdoc, const UString & out_filename, const XODOutputOptions& options = XODOutputOptions());
923 
941  static void ToHtml(const UString & in_filename, const UString & out_path, const HTMLOutputOptions& options = HTMLOutputOptions());
942 
957  static void ToHtml(PDFDoc & in_pdfdoc, const UString & out_path, const HTMLOutputOptions& options = HTMLOutputOptions());
958 
978  static void ToEpub(const UString & in_filename, const UString & out_path, const HTMLOutputOptions& html_options = HTMLOutputOptions(), const EPUBOutputOptions& epub_options = EPUBOutputOptions());
979 
996  static void ToEpub(PDFDoc & in_pdfdoc, const UString & out_path, const HTMLOutputOptions& html_options = HTMLOutputOptions(), const EPUBOutputOptions& epub_options = EPUBOutputOptions());
997 
1010  static void ToTiff(const UString & in_filename, const UString & out_path, const TiffOutputOptions& options = TiffOutputOptions());
1011 
1024  static void ToTiff(PDFDoc & in_pdfdoc, const UString & out_path, const TiffOutputOptions& options = TiffOutputOptions());
1025 
1044  static Filters::Filter ToXod(const UString & in_filename, const XODOutputOptions& options = XODOutputOptions());
1045 
1062  static Filters::Filter ToXod(PDFDoc & in_pdfdoc, const XODOutputOptions& options = XODOutputOptions());
1064  // Experimental - Developer use only
1065  static ConversionMonitor ToXodWithMonitor(PDFDoc & in_pdfdoc, const XODOutputOptions& options = XODOutputOptions());
1067 
1068 
1090  static void WordToPDF( PDFDoc & in_pdfdoc, const UString & in_filename, WordToPDFOptions* options);
1091 
1118  static DocumentConversion WordToPDFConversion( PDFDoc & in_pdfdoc, const UString & in_filename, WordToPDFOptions* options);
1119 
1141  static void WordToPDF( PDFDoc & in_pdfdoc, Filters::Filter in_stream, WordToPDFOptions* options);
1142 
1169  static DocumentConversion WordToPDFConversion( PDFDoc & in_pdfdoc, Filters::Filter in_stream, WordToPDFOptions* options);
1170 
1190  static void ToPdf(PDFDoc & in_pdfdoc, const UString & in_filename);
1191 
1204  static bool RequiresPrinter(const UString & in_filename);
1205 
1210  class Printer
1211  {
1212  public:
1227  static void Install(const UString & in_printerName = "PDFTron PDFNet");
1228 
1236  static void Uninstall();
1237 
1246  static const UString GetPrinterName();
1247 
1256  static void SetPrinterName(const UString & in_printerName = "PDFTron PDFNet");
1257 
1269  static bool IsInstalled(const UString & in_printerName = "PDFTron PDFNet");
1270 
1271  enum Mode {
1288  };
1289 
1295  static void SetMode(Mode mode);
1296 
1302  static Mode GetMode();
1303 
1304 
1305  };
1306 
1307 private:
1308  Convert ();
1309  ~Convert ();
1310 };
1311 
1312 
1313 #include <Impl/Convert.inl>
1314 
1315  }; // namespace PDF
1316 }; // namespace pdftron
1317 
1318 #endif // PDFTRON_H_CPPPDFConvert
static void ToHtml(const UString &in_filename, const UString &out_path, const HTMLOutputOptions &options=HTMLOutputOptions())
void SetMaximumImagePixels(UInt32 max_pixels)
void SetReportFile(const UString &path)
void SetEncryptPassword(const char *pass)
void SetOpacityMaskWorkaround(bool opacity_render)
static void ToEpub(const UString &in_filename, const UString &out_path, const HTMLOutputOptions &html_options=HTMLOutputOptions(), const EPUBOutputOptions &epub_options=EPUBOutputOptions())
void SetRemoveCharPlacement(bool remove_char_placement)
static void ToEmf(PDFDoc &in_pdfdoc, const UString &in_filename)
static void FromXps(PDFDoc &in_pdfdoc, const UString &in_filename)
ConversionMonitor & operator=(const ConversionMonitor &other)
void SetFlattenContent(enum FlattenFlag flatten)
void SetFlattenContent(enum FlattenFlag flatten)
void SetFlattenMaximumImagePixels(UInt32 max_pixels)
TRN_ConversionMonitor mp_impl
Definition: Convert.h:40
void SetFlattenThreshold(enum FlattenThresholdFlag threshold)
static void ToTiff(const UString &in_filename, const UString &out_path, const TiffOutputOptions &options=TiffOutputOptions())
void SetOverprint(enum OverprintPreviewMode mode)
static void FromEmf(PDFDoc &in_pdfdoc, const UString &in_filename)
static void ToSvg(PDFDoc &in_pdfdoc, const UString &in_filename, const SVGOutputOptions &in_options=SVGOutputOptions())
static void SetMode(Mode mode)
void SetClip(double x1, double y1, double x2, double y2)
void SetEmbedImages(bool embed_images)
void SetFlattenThreshold(enum FlattenThresholdFlag threshold)
static void FromText(PDFDoc &in_pdfdoc, const UString &in_filename, const SDF::Obj &in_options=SDF::Obj())
void SetOverprint(enum PDFRasterizer::OverprintPreviewMode mode)
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
static DocumentConversion WordToPDFConversion(PDFDoc &in_pdfdoc, const UString &in_filename, WordToPDFOptions *options)
void SetPages(const char *page_desc)
void SetEmbedFonts(bool embed_fonts)
void SetSilverlightTextWorkaround(bool workaround)
static void Install(const UString &in_printerName="PDFTron PDFNet")
void SetElementLimit(UInt32 element_limit)
static void ToPdf(PDFDoc &in_pdfdoc, const UString &in_filename)
void SetRotate(enum Page::Rotate rotation)
static bool IsInstalled(const UString &in_printerName="PDFTron PDFNet")
static void ToXod(const UString &in_filename, const UString &out_filename, const XODOutputOptions &options=XODOutputOptions())
static bool RequiresPrinter(const UString &in_filename)
static ConversionMonitor ToXodWithMonitor(PDFDoc &in_pdfdoc, const XODOutputOptions &options=XODOutputOptions())
static const UString GetPrinterName()
void SetOutputThumbnails(bool include_thumbs)
void SetAnnotationOutput(enum AnnotationOutputFlag annot_output)
static void SetPrinterName(const UString &in_printerName="PDFTron PDFNet")
void SetOutputThumbnails(bool include_thumbs)
static void WordToPDF(PDFDoc &in_pdfdoc, const UString &in_filename, WordToPDFOptions *options)
void UseSilverlightFlashCompatible(bool compatible)
void SetIndividualCharPlacement(bool individual_char_placement)
void SetOverprint(PDFRasterizer::OverprintPreviewMode mode)
static void ToXps(PDFDoc &in_pdfdoc, const UString &in_filename, const XPSOutputOptions &options=XPSOutputOptions())
void SetMaximumImagePixels(UInt32 max_pixels)
void SetBox(enum Page::Box type)

© 2002-2014 PDFTron Systems Inc.