New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cordova-pdf-generator

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-pdf-generator - npm Package Compare versions

Comparing version 1.0.14 to 1.1.0

2

package.json
{
"name": "cordova-pdf-generator",
"version": "1.0.14",
"version": "1.1.00",
"description": "is a HTML to PDF (offline) Generator.",

@@ -5,0 +5,0 @@ "cordova": {

@@ -10,3 +10,3 @@ # cordova-pdf-generator

- Generates a PDF document using a URL or HTML.
- Generates a PDF document using an URL, raw HTML text, HTMLElement and JQuery Element.
- Open-with menu, open the context menu and (push to cloud, print, save, mail, etc...).

@@ -13,0 +13,0 @@ - Return the Base64 file representation back, so you can upload the file to a server (IOS only).

/*global cordova, module*/
function html_to_text(html) {
if(typeof html === 'undefined') throw "undefined element, make sure the element is not empty.";
var div = document.createElement('div')
div.appendChild(html.cloneNode(true));
return div.innerHTML;
}
module.exports = {
htmlToPDF: function (options, successCallback, errorCallback) {
if(!options.url && !options.data) throw "No URL or HTML Data found.";
var url = options.url;
var data = options.data;
var docSize = options.documentSize || "A4";
var landscape = options.landscape || "portrait";
var type = options.type || "base64";
var fileName = options.fileName || "default";
htmlToPDF: function(options, successCallback, errorCallback) {
if (!options.url && !options.data) throw "No URL or HTML Data found.";
if (options.data instanceof HTMLElement) {
options.data = html_to_text(options.data);
}
cordova.exec(successCallback, errorCallback, "PDFService", "htmlToPDF", [ url, data, docSize, landscape, type, fileName ]);
if(typeof options.data === 'object' && 'html' in options.data){
options.data = html_to_text(options.data[0]);
}
var url = options.url;
var data = options.data;
var docSize = options.documentSize || "A4";
var landscape = options.landscape || "portrait";
var type = options.type || "base64";
var fileName = options.fileName || "default";
cordova.exec(successCallback, errorCallback, "PDFService", "htmlToPDF", [url, data, docSize, landscape, type, fileName]);
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc