npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-print-pdf-landscape

v1.1.1

Published

Cordova Print PDF Plugin in landscape mode, also provides save functionality for android

Downloads

50

Readme

Print PDF plugin for Cordova / PhoneGap now in landscape!

This plugin is a fork from: sarahgoldman, modified to fit a specific use case.

This plugin brings up a native overlay to print a PDF document using AirPrint for iOS and Android Printing APIs on Android devices running 4.4 (API 19) or later. For Android devices running 4.3 or less, it will open a Google Cloud Print dialog.

Usage

print(options)

Use the print function to print an encoded document via a native printing interface.

window.plugins.PrintPDF.print(options);

The default options object

var options = {

	data: null, 				// content, either base64 string or file uri (required)
								// (omit "data:application/pdf;base64," part from base64 string)

	type: 'Data',				// type of content, use either 'Data' or 'File'

	title: 'Print Document', 	// title of document

	dialogX: -1,				// if a dialog coord is not set, it defaults to -1.
								// the iOS method will fall back to center if it gets
	dialogY: -1,				// a dialog coord less than 0. (iPad only)

	success: null,				// success callback function, argument is a json string.
	 							// parsed json format:
								// {success: true}

	error: null					// error callback function, argument is a json string.
	 							// parsed json format:
								// {success: [boolean], available: [boolean], error: [string], dismissed: [boolean]}

};

Example:

var encodedString = 'base64encodedStringHere';
window.plugins.PrintPDF.print({
	data: encodedString,
	type: 'Data',
	title: 'Print Document',
	success: function(){
		console.log('success');
	},
	error: function(data){
		data = JSON.parse(data);
		console.log('failed: ' + data.error);
	}
});

dismiss()

Use the dismiss function to programmatically dismiss the print dialog (iOS only). There are no options that can be passed in. When the dialog is dismissed it will trigger the error callback that was set for the print() function with the dismissed parameter set to true.

window.plugins.PrintPDF.dismiss();

isPrintingAvailable(callback)

Use the isPrintingAvailable function to check if native printing is supported and available.

window.plugins.PrintPDF.isPrintingAvailable(callback);

Example:

window.plugins.PrintPDF.isPrintingAvailable( function(isAvailable) {
	console.log('printing is available: '+ isAvailable);
});