Skip to content
This repository has been archived by the owner on Nov 24, 2019. It is now read-only.

benbahrenburg/benCoding.PDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

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.

Before you start

* 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.

Download the release

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.

Building from source?

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

Setup

  • 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');

Creating the Converters Object

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();

Methods

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);	
	});

Dependent Projects

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.

Licensing & Support

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

Learn More

Examples

Please check the module's example folder for details.

These samples are also available on github at the following:

Android Examples

iOS Examples

Twitter

Please consider following the @benCoding Twitter for updates and more about Titanium.

Blog

For module updates, Titanium tutorials and more please check out my blog at benCoding.Com.