Skip to content

mbackschat/cordova-plugin-image2pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-image2pdf

The plugin is exposed via the cordova.plugins.image2pdf object, which converts an image file into a PDF file.

Installation

cordova plugin add https://github.com/mbackschat/cordova-plugin-image2pdf.git

API

convert(source, target, onSuccess, onError)

Converts the image at the given file path to a PDF file.

  • source image file path (String)
    • if relative then "<mainBundle:resourcePath>/www" is prepended
    • ~ gets expanded. Example. "~/tmp/input.jpg"
  • target PDF file path (String)
    • if relative then "~/tmp" is prepended
    • ~ gets expanded. Example. "~/tmp/output.pdf"
  • onSuccess callback is called without parameters
  • onError callback is called with error code (Int)
    • error code == 1: Image file not found,
    • error code == 2: PDF file write error

Quick Example

// source: www/test.jpg
// target: ~/tmp/test.pdf
cordova.plugins.image2pdf.convert("test.jpg", "test.pdf",
    function () { console.log("Done") },
    function (code) { console.log("Error code " + code) })

Supported Platforms

  • iOS
    • Supported image file formats: .png, .tiff/.tif, .jpeg/.jpg, .gif, .bmp/.BMPf, .ico, .cur, .xbm
      See also Apple documentation.

About

Cordova Image to PDF converter

Resources

License

Stars

Watchers

Forks

Packages

No packages published