PTConvert

@interface PTConvert : NSObject

Convert the input file to XPS format and save to the specified path

See

XPSOutputOptions

See

ToPdf()

@note: Requires the Convert::Printer class for all file formats that ToPdf also requires.

  • Undocumented

    Declaration

    Objective-C

    + (void)FromXpsWithFilename: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename;

    Swift

    class func fromXps(withFilename in_pdfdoc: PTPDFDoc!, in_filename: String!)
  • Undocumented

    Declaration

    Objective-C

    + (void)FromXpsWithBuffer: (PTPDFDoc*)in_pdfdoc buf:  (NSString *)buf buf_sz:  (unsigned long)buf_sz;

    Swift

    class func fromXps(withBuffer in_pdfdoc: PTPDFDoc!, buf: String!, buf_sz: UInt)
  • Undocumented

    Declaration

    Objective-C

    + (void)FromEmf: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename;

    Swift

    class func fromEmf(_ in_pdfdoc: PTPDFDoc!, in_filename: String!)
  • Undocumented

    Declaration

    Objective-C

    + (void)FromText: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename in_options:  (PTObj*)in_options;

    Swift

    class func fromText(_ in_pdfdoc: PTPDFDoc!, in_filename: String!, in_options: PTObj!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToEmfWithPDFDoc: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename;

    Swift

    class func toEmf(with in_pdfdoc: PTPDFDoc!, in_filename: String!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToEmfWithPage: (PTPage*)in_page in_filename:  (NSString *)in_filename;

    Swift

    class func toEmf(with in_page: PTPage!, in_filename: String!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToSvgWithPDFDoc: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename in_options:  (PTSVGOutputOptions*)in_options;

    Swift

    class func toSvg(with in_pdfdoc: PTPDFDoc!, in_filename: String!, in_options: PTSVGOutputOptions!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToSvg: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename;

    Swift

    class func toSvg(_ in_pdfdoc: PTPDFDoc!, in_filename: String!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToSvgWithPage: (PTPage*)in_page in_filename:  (NSString *)in_filename in_options:  (PTSVGOutputOptions*)in_options;

    Swift

    class func toSvg(with in_page: PTPage!, in_filename: String!, in_options: PTSVGOutputOptions!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToXpsWithPDFDoc: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename options:  (PTXPSOutputOptions*)options;

    Swift

    class func toXps(with in_pdfdoc: PTPDFDoc!, in_filename: String!, options: PTXPSOutputOptions!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToXps: (PTPDFDoc*)in_pdfdoc in_filename:  (NSString *)in_filename;

    Swift

    class func toXps(_ in_pdfdoc: PTPDFDoc!, in_filename: String!)
  • Undocumented

    Declaration

    Objective-C

    + (void)ToXpsWithFilename: (NSString *)in_inputFilename in_outputFilename:  (NSString *)in_outputFilename options:  (PTXPSOutputOptions*)options;

    Swift

    class func toXps(withFilename in_inputFilename: String!, in_outputFilename: String!, options: PTXPSOutputOptions!)
  • Convert the input file to XOD format and save to the specified path

    See

    XODOutputOptions

    See

    ToPdf()

    @note: Requires the Convert::Printer class for all file formats that ToPdf also requires.

    Declaration

    Objective-C

    + (void)ToXodWithFilename:(NSString *)in_filename
                 out_filename:(NSString *)out_filename
                      options:(PTXODOutputOptions *)options;

    Swift

    class func toXod(withFilename in_filename: String!, out_filename: String!, options: PTXODOutputOptions!)

    Parameters

    in_filename

    the file to convert to XOD

    out_filename

    the path to the XOD file to create

    options

    the conversion options

  • Convert the input file to XOD format and save to the specified path

    See

    XODOutputOptions

    See

    ToPdf()

    Declaration

    Objective-C

    + (void)ToXod:(NSString *)in_filename out_filename:(NSString *)out_filename;

    Swift

    class func toXod(_ in_filename: String!, out_filename: String!)

    Parameters

    in_pdfdoc

    the PDFDoc to convert to XOD

    out_filename

    the path to the XOD file to create

    options

    the conversion options

  • Undocumented

    Declaration

    Objective-C

    + (void)ToXodWithPDFDoc: (PTPDFDoc*)in_pdfdoc out_filename:  (NSString *)out_filename options:  (PTXODOutputOptions*)options;

    Swift

    class func toXod(with in_pdfdoc: PTPDFDoc!, out_filename: String!, options: PTXODOutputOptions!)
  • Convert a file to HTML and save to the specified path

    See

    HTMLOutputOptions

    See

    ToPdf()

    @note: Requires the Convert::Printer class for all file formats that ToPdf also requires.

    Declaration

    Objective-C

    + (void)ToHtmlWithFilename:(NSString *)in_filename
                      out_path:(NSString *)out_path
                       options:(PTHTMLOutputOptions *)options;

    Swift

    class func toHtml(withFilename in_filename: String!, out_path: String!, options: PTHTMLOutputOptions!)

    Parameters

    in_filename

    the file to convert to HTML

    out_path

    the path to where generated content will be stored

    options

    the conversion options

  • Convert the PDF to HTML and save to the specified path

    See

    HTMLOutputOptions

    See

    ToPdf()

    Declaration

    Objective-C

    + (void)ToHtml:(NSString *)in_filename out_path:(NSString *)out_path;

    Swift

    class func toHtml(_ in_filename: String!, out_path: String!)

    Parameters

    in_pdfdoc

    the PDF doc to convert to HTML

    out_path

    the path to where generated content will be stored

    options

    the conversion options

  • Undocumented

    Declaration

    Objective-C

    + (void)ToHtmlWithPDFDoc: (PTPDFDoc*)in_pdfdoc out_path:  (NSString *)out_path options:  (PTHTMLOutputOptions*)options;

    Swift

    class func toHtml(with in_pdfdoc: PTPDFDoc!, out_path: String!, options: PTHTMLOutputOptions!)
  • Convert a file to EPUB format and save to the specified path

    See

    HTMLOutputOptions

    See

    EPUBOutputOptions

    See

    ToPdf()

    @note: Requires the Convert::Printer class for all file formats that ToPdf also requires.

    Declaration

    Objective-C

    + (void)ToEpubWithFilename:(NSString *)in_filename
                      out_path:(NSString *)out_path
                  html_options:(PTHTMLOutputOptions *)html_options
                  epub_options:(PTEPUBOutputOptions *)epub_options;

    Swift

    class func toEpub(withFilename in_filename: String!, out_path: String!, html_options: PTHTMLOutputOptions!, epub_options: PTEPUBOutputOptions!)

    Parameters

    in_filename

    the file to convert to EPUB

    out_path

    the path to the EPUB file to create

    html_options

    the conversion options

    epub_options

    the conversion options

  • Convert the PDFDoc to EPUB format and save to the specified path

    See

    HTMLOutputOptions

    See

    EPUBOutputOptions

    See

    ToPdf()

    Declaration

    Objective-C

    + (void)ToEpub:(NSString *)in_filename
            out_path:(NSString *)out_path
        html_options:(PTHTMLOutputOptions *)html_options;

    Swift

    class func toEpub(_ in_filename: String!, out_path: String!, html_options: PTHTMLOutputOptions!)

    Parameters

    in_pdfdoc

    the PDFDoc to convert to EPUB

    out_path

    the path to the EPUB file to create

    html_options

    the conversion options

    epub_options

    the conversion options

  • Undocumented

    Declaration

    Objective-C

    + (void)ToEpubWithPDFDoc: (PTPDFDoc*)in_pdfdoc out_path:  (NSString *)out_path html_options:  (PTHTMLOutputOptions*)html_options epub_options:  (PTEPUBOutputOptions*)epub_options;

    Swift

    class func toEpub(with in_pdfdoc: PTPDFDoc!, out_path: String!, html_options: PTHTMLOutputOptions!, epub_options: PTEPUBOutputOptions!)
  • Convert a file to multipage TIFF and save to the specified path

    See

    TiffOutputOptions

    Declaration

    Objective-C

    + (void)ToTiff:(NSString *)in_filename
          out_path:(NSString *)out_path
           options:(PTTiffOutputOptions *)options;

    Swift

    class func toTiff(_ in_filename: String!, out_path: String!, options: PTTiffOutputOptions!)

    Parameters

    in_filename

    the file to convert to multipage TIFF

    out_path

    the path to the TIFF file to create

    options

    the conversion options

  • Generate a stream that incrementally converts the input file to XOD format.

    See

    XODOutputOptions

    See

    ToPdf()

    @note: Requires the Convert::Printer class for all file formats that ToPdf also requires.

    Declaration

    Objective-C

    + (PTFilter *)ToXodWithFilenameToStream:(NSString *)in_filename
                                    options:(PTXODOutputOptions *)options;

    Swift

    class func toXodWithFilename(toStream in_filename: String!, options: PTXODOutputOptions!) -> PTFilter!

    Parameters

    in_filename

    the file to convert to XOD

    options

    the conversion options

    Return Value

    A filter from which the file can be read incrementally.

  • Generate a stream that incrementally converts the input file to XOD format.

    See

    XODOutputOptions

    See

    ToPdf()

    Declaration

    Objective-C

    + (PTFilter *)ToXodWithPDFDocToStream:(PTPDFDoc *)in_pdfdoc
                                  options:(PTXODOutputOptions *)options;

    Swift

    class func toXodWithPDFDoc(toStream in_pdfdoc: PTPDFDoc!, options: PTXODOutputOptions!) -> PTFilter!

    Parameters

    in_pdfdoc

    the PDFDoc to convert to XOD

    options

    the conversion options

    Return Value

    A filter from which the file can be read incrementally.

  • Undocumented

    Declaration

    Objective-C

    + (PTConversionMonitor*)ToXodWithMonitorAndOptions: (PTPDFDoc*)in_pdfdoc options:  (PTXODOutputOptions*)options;

    Swift

    class func toXod(withMonitorAndOptions in_pdfdoc: PTPDFDoc!, options: PTXODOutputOptions!) -> PTConversionMonitor!
  • Undocumented

    Declaration

    Objective-C

    + (PTConversionMonitor*)ToXodWithMonitor: (PTPDFDoc*)in_pdfdoc;

    Swift

    class func toXod(withMonitor in_pdfdoc: PTPDFDoc!) -> PTConversionMonitor!
  • Convert the a Word document (in .docx format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality.

    Note

    Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion

    @throws PDFNetException

    See

    WordToPDFOptions

    See

    WordToPdfConversion() if you would like more control over the conversion process

    Declaration

    Objective-C

    + (void)WordToPDF:(PTPDFDoc *)in_pdfdoc
          in_filename:(NSString *)in_filename
              options:(PTWordToPDFOptions *)options;

    Swift

    class func word(toPDF in_pdfdoc: PTPDFDoc!, in_filename: String!, options: PTWordToPDFOptions!)

    Parameters

    in_pdfdoc

    the conversion result will be appended to this pdf.

    in_filename

    the path to the source document. The source must be in .docx format.

    options

    the conversion options

  • Create a DocumentConversion object suitable for converting a Word document (in .docx format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality.

    This method allows for more control over the conversion process than the single call WordToPDF() interface. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object.

    See

    DocumentConversion

    Note

    Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion

    See

    WordToPDFOptions

    Declaration

    Objective-C

    + (PTDocumentConversion *)WordToPDFConversion:(PTPDFDoc *)in_pdfdoc
                                      in_filename:(NSString *)in_filename
                                          options:(PTWordToPDFOptions *)options;

    Swift

    class func word(toPDFConversion in_pdfdoc: PTPDFDoc!, in_filename: String!, options: PTWordToPDFOptions!) -> PTDocumentConversion!

    Parameters

    in_pdfdoc

    the conversion result will be appended to this pdf.

    in_filename

    the path to the source document. The source must be in .docx format.

    options

    the conversion options

    Return Value

    A DocumentConversion object which encapsulates this particular conversion.

  • Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality.

    Note

    Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion

    @throws PDFNetException

    See

    ConversionOptions

    See

    StreamingPDFConversion() if you would like more control over the conversion process

    Declaration

    Objective-C

    + (void)OfficeToPDF:(PTPDFDoc *)in_pdfdoc
            in_filename:(NSString *)in_filename
                options:(PTConversionOptions *)options;

    Swift

    class func office(toPDF in_pdfdoc: PTPDFDoc!, in_filename: String!, options: PTConversionOptions!)

    Parameters

    in_pdfdoc

    the conversion result will be appended to this pdf.

    in_filename

    the path to the source document.

    options

    the conversion options

  • Create a DocumentConversion object suitable for converting a file to pdf and appending to the specified PDF document. Handles incoming files in .docx, .xlsx, pptx, .doc, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality.

    This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object.

    See

    DocumentConversion

    Note

    Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion

    See

    ConversionOptions

    Declaration

    Objective-C

    + (PTDocumentConversion *)StreamingPDFConversionWithDoc:(PTPDFDoc *)in_pdfdoc
                                                in_filename:(NSString *)in_filename
                                                    options:(PTConversionOptions *)
                                                                options;

    Swift

    class func streamingPDFConversion(with in_pdfdoc: PTPDFDoc!, in_filename: String!, options: PTConversionOptions!) -> PTDocumentConversion!

    Parameters

    in_pdfdoc

    the conversion result will be appended to this pdf.

    in_filename

    the path to the source document.

    options

    the conversion options

    Return Value

    A DocumentConversion object which encapsulates this particular conversion.

  • Create a DocumentConversion object suitable for converting a file to pdf. Handles incoming files in .docx, .xlsx, pptx, .doc, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality.

    This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object.

    See

    DocumentConversion

    Note

    Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion

    See

    ConversionOptions

    Declaration

    Objective-C

    + (PTDocumentConversion *)StreamingPDFConversion:(NSString *)in_filename
                                             options:(PTConversionOptions *)options;

    Swift

    class func streamingPDFConversion(_ in_filename: String!, options: PTConversionOptions!) -> PTDocumentConversion!

    Parameters

    in_filename

    the path to the source document.

    options

    the conversion options

    Return Value

    A DocumentConversion object which encapsulates this particular conversion.

  • Convert the file or document to PDF and append to the specified PDF document

    Note

    Internally formats include BMP, EMF, JPEG, PNG, TIF, XPS.

    Note

    Formats that require external applications for conversion use the Convert::Printer class and the PDFNet printer to be installed. This is only supported on Windows platforms. Document formats in this category include RTF(MS Word or Wordpad), TXT (Notepad or Wordpad), DOC and DOCX (MS Word), PPT and PPTX (MS PowerPoint), XLS and XLSX (MS Excel), OpenOffice documents, HTML and MHT (Internet Explorer), PUB (MS Publisher), MSG (MS Outlook).

    Declaration

    Objective-C

    + (void)ToPdf:(PTPDFDoc *)in_pdfdoc in_filename:(NSString *)in_filename;

    Swift

    class func toPdf(_ in_pdfdoc: PTPDFDoc!, in_filename: String!)

    Parameters

    in_pdfdoc

    the PDFDoc to append the converted document to. The PDFDoc can then be converted to XPS, EMF or SVG using the other functions in this class.

    in_filename

    the path to the document to be converted to pdf

  • Convert the specified CAD file to PDF and append converted pages to the specified PDF document. This conversion requires that the optional PDFTron CAD add-on module is avaialable. ee the CADConvertOptions class for the available options. See also: the ‘CADModule’ class

    Declaration

    Objective-C

    + (void)FromCAD:(PTPDFDoc *)in_pdfdoc
        in_filename:(NSString *)in_filename
               opts:(PTCADConvertOptions *)opts;

    Swift

    class func fromCAD(_ in_pdfdoc: PTPDFDoc!, in_filename: String!, opts: PTCADConvertOptions!)

    Parameters

    in_pdfdoc

    the PDFDoc to append to

    in_filename

    the path to the CAD document to convert

    opts

    The options to use when converting.

  • Convert the specified TIFF filter to PDF and append converted pages to the specified PDF document.

    Declaration

    Objective-C

    + (void)FromTiff:(PTPDFDoc *)in_pdfdoc in_data:(PTFilter *)in_data;

    Swift

    class func fromTiff(_ in_pdfdoc: PTPDFDoc!, in_data: PTFilter!)

    Parameters

    in_pdfdoc

    the PDFDoc to append to

    in_data,

    the source TIFF data.

  • Utility function to determine if ToPdf or ToXps will require the PDFNet printer to convert a specific external file to PDF.

    Note

    Current implementation looks only at the file extension not file contents. If the file extension is missing, false will be returned

    Declaration

    Objective-C

    + (BOOL)RequiresPrinter:(NSString *)in_filename;

    Swift

    class func requiresPrinter(_ in_filename: String!) -> Bool

    Parameters

    in_filename

    the path to the document to be checked

    Return Value

    true if ToPdf requires the printer to convert the file, false otherwise.

  • Converts an HTML string to PDF using a WKWebView.

    Declaration

    Objective-C

    + (void)convertHTMLStringToPDF:(NSString *)htmlString
                           baseURL:(NSURL *)baseURL
                         paperSize:(CGSize)paperSize
                        completion:(void (^)(NSString *))completion;

    Swift

    class func convertHTMLString(toPDF htmlString: String!, baseURL: URL!, paperSize: CGSize, completion: ((String?) -> Void)!)

    Parameters

    htmlString

    The string containing valid HTML.

    baseURL

    The base URL for the content.

    paperSize

    The size of the paper in units of PDF Points. Passing CGSizeZero will default to letter size, portrait orientation (612.0, 792.0)

    completion

    A block that is executed when the conversion is complete. The paramater pathToPDF will point to the newly converted PDF. The PDF will be deleted after the execution of the completion block, so it should be copied if required beyond the completion block.

  • Converts office format documents and any document supported by WKWebView to PDF.

    Declaration

    Objective-C

    + (void)convertOfficeToPDF:(NSString *)filePath
                     paperSize:(CGSize)paperSize
                    completion:(void (^)(NSString *))completion;

    Swift

    class func convertOffice(toPDF filePath: String!, paperSize: CGSize, completion: ((String?) -> Void)!)

    Parameters

    filePath

    The path of the source document

    paperSize

    The size of the paper in units of PDF Points. Passing CGSizeZero will default to letter size, portrait orientation (612.0, 792.0)

    completion

    A block that is executed when the conversion is complete. The paramater pathToPDF will point to the newly converted PDF. The PDF will be deleted after the execution of the completion block, so it should be copied if required beyond the completion block.

  • Converts office format documents and any document supported by WKWebView to PDF.

    Declaration

    Objective-C

    + (void)convertOfficeToPDFWithURL:(NSURL *)url
                            paperSize:(CGSize)paperSize
                           completion:(void (^)(NSString *))completion;

    Swift

    class func convertOfficeToPDF(with url: URL!, paperSize: CGSize, completion: ((String?) -> Void)!)

    Parameters

    url

    The URL of the source document

    paperSize

    The size of the paper in units of PDF Points. Passing CGSizeZero will default to letter size, portrait orientation (612.0, 792.0)

    completion

    A block that is executed when the conversion is complete. The paramater pathToPDF will point to the newly converted PDF. The PDF will be deleted after the execution of the completion block, so it should be copied if required beyond the completion block.