benCoding.PDF.Converters
The benCoding.PDF Converters proxy provides conversion helper functions when working with PDFs. At the moment the feature list is pretty small, but will be growing as needed or contributions are provided.
* This is a module designed to work with Titanium SDK 3.0.0GA * Before using this module you first need to install the package. If you need instructions on how to install a 3rd party module please read this installation guide.There is two ways you can download this module.
Android:
The go to the dist folder. This will have a release compiled for anyone download it from github.
iOS:
The go to the dist folder. This will have a release compiled for anyone download it from github.
If you are building from source you will need to do the following:
- Modify the titanium.xcconfig file with the path to your Titanium installation
- Download the latest release from the releases folder ( or you can build it yourself )
- Install the bencoding.sms module. If you need help here is a "How To" guide.
- You can now use the module via the commonJS require method, example shown below.
var pdf = require('bencoding.pdf');
Requiring the module into your project
//Require the securely module into your project
var pdf = require('bencoding.pdf');
//Create a new properties object
var converters = pdf.createConverters();
convertImageToPDF( TiBlob image, int resolution ) Adds the specified callback as an event listener for the named event.
Parameters image : TiBlob Image to be converted into PDF resolution : int Optional resolution value. Only applies to iOS
Returns TiBlob
Example
Ti.Media.takeScreenshot(function(event){
// set blob on image view
var image = event.media;
var pdfBlob = converters.convertImageToPDF(image,100);
var pdfFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'text.pdf');
pdfFile.write(pdfBlob);
});
The benCoding.PDF module uses the below projects. I highly encourage you to check them out using the information below.
iText ( used on Android only)
Please visit iText Website to learn more
Please note iText is licensed under the GNU Affero General Public License version 3 and depending on the nature of your app you might need a license. Please visit license for details.
This project is licensed under the OSI approved Apache Public License (version 2). For details please see the license associated with each project.
Developed by Ben Bahrenburg available on twitter @benCoding
Please check the module's example folder for details.These samples are also available on github at the following:
Please consider following the @benCoding Twitter for updates and more about Titanium.
For module updates, Titanium tutorials and more please check out my blog at benCoding.Com.