Giter Club home page Giter Club logo

tijspdf's Introduction

TiJSPDF

TiJSPDF is a JSPDF plugin for Titanium Mobile applications that allows you to generate your PDFs using the JSPDF library and manipulate them within your Titanium Mobile application.

This plugin is maintained separately from Titanium and is not currently supported by Appcelerator through any premium or community support offereings.

Please double check all of your code before deploying an app with this plugin. It took all of 10 minutes to port and I cannot speak to the practices of the original author. If you see something wrong and you think that you know a better way, then fork it and git 'er done.

Documentation

Visit the JSPDF blog post for PDF creation guidance.

In The Box

This project contains an example application using a demo from the JSPDF demo page. If you'd rather just get going on making your own app, you can download just the modified js files from the 'Downloads' section. Just drop the uncompressed files into your '/app/assets/' folder and start building. EDIT: This used to say "Just drop the uncompressed files into your 'Resources' folder..." This has now become incorrect with Appcelerator's use of Alloy. You now will need to drop the uncompressed files into the path specified above.

Usage

Ripped straight from the included example app.

// Include the JSPDF libraries
// ****EDIT: Now with the use of Alloy, you will need to include the rest of the path following /app/assets/.****
// **** For example, your file might be located in /app/assets/TiJSPDF-master/Resources/jspdf.js ****
// **** You will also need to edit the includes in jspdf.js to do the same ****
Ti.include('jspdf.js');

var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');

var file = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'test.pdf');
file.write(doc.output());
var pdfview = Ti.UI.createWebView({width:'100%',height:'100%',data:file});
var win = Ti.UI.createWindow();
win.add(pdfview);
win.open({modal:true});

And thats about it.

tijspdf's People

Contributors

mindelusions avatar helizabethwhite avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.