kandi background
Explore Kits

GoogleCloudPrint | Google Cloud Print API for Java | GCP library

 by   jittagornp Java Version: Current License: Apache-2.0

 by   jittagornp Java Version: Current License: Apache-2.0

kandi X-RAY | GoogleCloudPrint Summary

GoogleCloudPrint is a Java library typically used in Cloud, GCP applications. GoogleCloudPrint has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can download it from GitHub.
There are two ways to do that:. Recommended from João Vianey (Google Cloud Print developer) Thank you very much.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • GoogleCloudPrint has a low active ecosystem.
  • It has 47 star(s) with 28 fork(s). There are 10 watchers for this library.
  • It had no major release in the last 6 months.
  • There are 2 open issues and 1 have been closed. On average issues are closed in 3 days. There are 1 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of GoogleCloudPrint is current.
GoogleCloudPrint Support
Best in #GCP
Average in #GCP
GoogleCloudPrint Support
Best in #GCP
Average in #GCP

quality kandi Quality

  • GoogleCloudPrint has 0 bugs and 0 code smells.
GoogleCloudPrint Quality
Best in #GCP
Average in #GCP
GoogleCloudPrint Quality
Best in #GCP
Average in #GCP

securitySecurity

  • GoogleCloudPrint has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • GoogleCloudPrint code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
GoogleCloudPrint Security
Best in #GCP
Average in #GCP
GoogleCloudPrint Security
Best in #GCP
Average in #GCP

license License

  • GoogleCloudPrint is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
GoogleCloudPrint License
Best in #GCP
Average in #GCP
GoogleCloudPrint License
Best in #GCP
Average in #GCP

buildReuse

  • GoogleCloudPrint releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
GoogleCloudPrint Reuse
Best in #GCP
Average in #GCP
GoogleCloudPrint Reuse
Best in #GCP
Average in #GCP
Top functions reviewed by kandi - BETA

kandi has reviewed GoogleCloudPrint and discovered the below as its top functions. This is intended to give you an instant insight into GoogleCloudPrint implemented functionality, and help decide if they suit your requirements.

  • Register a printer .
    • Converts an input stream to a string .
      • Login to Google .
        • Main entry point .
          • Returns a String representation of the configuration .
            • Load properties from classpath .
              • Sets the connection status .
                • Sets the output writer capability .
                  • Get the horizontal distance .
                    • Returns the default value

                      Get all kandi verified functions for this library.

                      Get all kandi verified functions for this library.

                      GoogleCloudPrint Key Features

                      Load printer capabilities and create an XML(XPS format) file using Windows API. Ex.: Using "PrintQueue" class --> GetPrintCapabilitiesAsXml.WriteTo(file)

                      Obtaining the PPD file of the PostScript printer. Uploading one of these files, GCP was able to understand the printer capabilities.

                      GoogleCloudPrint Examples and Code Snippets

                      Community Discussions

                      Trending Discussions on GoogleCloudPrint
                      • Run Google script on single sheet instead of entire spreadsheet
                      • Function not executing with defined variables
                      • Merging two functions and executing in sequence
                      Trending Discussions on GoogleCloudPrint

                      QUESTION

                      Run Google script on single sheet instead of entire spreadsheet

                      Asked 2018-Feb-05 at 19:06

                      With my spreadsheet, I have 2 Google forms tied to 2 sheets. When a form gets submitted the script executes and does it's thing. However, I only want the script to execute based on a submission from a single sheet. As it is now, the script executes when either of the forms get submitted.

                      My two sheets are: Job Submission and Order Submission

                      Any advice?

                      // Work Order
                      
                      
                      // Get template from Google Docs and name it
                      var docTemplate = "";  // *** replace with your template ID ***
                      var docName     = "Work Order";
                      var printerId   = "";
                      
                      function addDates() {
                          var date = new Date(); // your form date
                          var holiday = ["09/04/2017","10/09/2017","11/23/2017","12/24/2017","12/25/2017","01/01/2018"]; //Define holiday dates in MM/dd/yyyy
                          var days = 5; //No of days you want to add
                          date.setDate(date.getDate());
                          var counter = 0;
                              if(days > 0 ){
                                  while (counter < days) {
                                      date.setDate(date.getDate() + 1 ); 
                                      var check = date.getDay(); 
                                      var holidayCheck = holiday.indexOf(Utilities.formatDate(date, "EDT", "MM/dd/yyyy"));
                                        if (check != 0 && check != 6  && holidayCheck == -1) {
                                               counter++;
                                          }
                                  }
                              }
                              Logger.log(date) //for this example will give 08/16/2017
                          return date;
                      }
                      
                      function createNewDoc(values) {
                      //Get information from form and set as variables
                        var email_address = "";
                        var job_name = values[1];
                        var order_count = values[2];
                        var order_form = values[7];
                        var print_services = values[3];
                        var priority = values[5];
                        var notes = values[6];
                        var formattedDate = Utilities.formatDate(new Date(), "EDT", "MM/dd/yyyy");
                        var expirationDate = Utilities.formatDate(addDates(), "EDT", "MM/dd/yyyy");
                      
                      // Get document template, copy it as a new temp doc, and save the Doc's id
                         var copyId = DriveApp.getFileById(docTemplate)
                                      .makeCopy(docName+' for '+job_name)
                                      .getId();
                      // Open the temporary document
                         var copyDoc = DocumentApp.openById(copyId);
                      // Get the document's body section
                         var copyBody = copyDoc.getActiveSection();
                      
                      // Replace place holder keys,in our google doc template  
                         copyBody.replaceText('keyJobName', job_name);
                         copyBody.replaceText('keyOrderCount', order_count);
                         copyBody.replaceText('keyOrderForm', order_form);
                         copyBody.replaceText('keyPrintServices', print_services);
                         copyBody.replaceText('keyPriority', priority);
                         copyBody.replaceText('keyNotes', notes);
                         copyBody.replaceText('keyDate', formattedDate);
                         copyBody.replaceText('keyDue', expirationDate);
                      
                      // Save and close the temporary document
                         copyDoc.saveAndClose();
                      
                      // Convert temporary document to PDF by using the getAs blob conversion
                         var pdf = DriveApp.getFileById(copyId).getAs("application/pdf"); 
                      
                      // Attach PDF and send the email
                         var subject = "New Job Submission - " + job_name;
                         var body    = "Here is the work order for " + job_name + ". Job is due " + expirationDate + ".";
                         MailApp.sendEmail(email_address, subject, body, {htmlBody: body, attachments: pdf}); 
                      
                      // Move file to folder
                         var file = DriveApp.getFileById(copyId);
                         DriveApp.getFolderById("").addFile(file);
                         file.getParents().next().removeFile(file);
                      
                         var newDocName = docName + ' for ' + job_name;
                         return [copyId, newDocName];
                      }
                      
                      function printGoogleDocument(copyId, docName) {  
                        // For notes on ticket options see https://developers.google.com/cloud-print/docs/cdd?hl=en
                        var ticket = {
                          version: "1.0",
                          print: {
                            color: {
                              type: "STANDARD_COLOR"
                            },
                            duplex: {
                              type: "NO_DUPLEX"
                            },
                          }
                        };
                      
                        var payload = {
                          "printerid" : "",
                          "content"   : copyId,
                          "title"  : docName,
                          "contentType" : "google.kix", // allows you to print google docs
                          "ticket"    : JSON.stringify(ticket),
                        };
                      
                        var response = UrlFetchApp.fetch('https://www.google.com/cloudprint/submit', {
                          method: "POST",
                          payload: payload,
                          headers: {
                            Authorization: 'Bearer ' + GoogleCloudPrint.getCloudPrintService().getAccessToken()
                          },
                          "muteHttpExceptions": true
                        });
                      
                        // If successful, should show a job here: https://www.google.com/cloudprint/#jobs
                      
                        response = JSON.parse(response);
                        if (response.success) {
                          Logger.log("%s", response.message);
                        } else {
                          Logger.log("Error Code: %s %s", response.errorCode, response.message);
                        }
                        return response;
                      }
                      
                      // When Form Gets submitted
                      function onFormSubmit(e) { 
                        var values = e.values;
                        var returnedDocValues = createNewDoc(values);
                        var copyId = returnedDocValues[0];
                        var docName= returnedDocValues[1];
                        printGoogleDocument(copyId, docName);
                      }
                      

                      Edit: I'm not sure how to do a complete or verifiable example since it's dependent on the form submission. I don't often work with javascript so I'm still learning.

                      Anyway, I updated my onFormSubmit function, however, my other functions have failed to execute. The script doesn't create the doc and in turn doesn't get sent to the google cloud print

                      // When Form Gets submitted
                      function onFormSubmit(e) { 
                      // Initialize
                        var rng = e.range;
                        var sheet = rng.getSheet();
                        var name = sheet.getName();
                      // If the response was not submitted to the right sheet, exit.
                        if(name != "Job Submission") return; 
                        var values = e.values;
                        var returnedDocValues = createNewDoc(values);
                        var copyId = returnedDocValues[0];
                        var docName= returnedDocValues[1];
                        printGoogleDocument(copyId, docName);
                      }

                      ANSWER

                      Answered 2018-Jan-30 at 16:55

                      If your onFormSubmit function is on a script bounded to the spreadsheet, the event object includes a range object. You could use getSheet to get the sheet and then getName to get the sheet name.

                      Example:

                      function onFormSubmit(e){
                        // Initialize
                        var rng = e.range;
                        var sheet = rng.getSheet();
                        var name = sheet.getName();
                      
                        // If the response was not submitted to the right sheet, exit.
                        if(name != "Responses 1") return; 
                      
                        //Otherwise continue
                      }
                      

                      Source https://stackoverflow.com/questions/48523280

                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                      Vulnerabilities

                      No vulnerabilities reported

                      Install GoogleCloudPrint

                      You can download it from GitHub.
                      You can use GoogleCloudPrint like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the GoogleCloudPrint component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

                      Support

                      For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

                      Find more information at:

                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 650 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      Clone
                      • https://github.com/jittagornp/GoogleCloudPrint.git

                      • gh repo clone jittagornp/GoogleCloudPrint

                      • git@github.com:jittagornp/GoogleCloudPrint.git

                      Share this Page

                      share link

                      See Similar Libraries in

                      Consider Popular GCP Libraries
                      Try Top Libraries by jittagornp
                      Compare GCP Libraries with Highest Support
                      Compare GCP Libraries with Highest Quality
                      Compare GCP Libraries with Highest Security
                      Compare GCP Libraries with Permissive License
                      Compare GCP Libraries with Highest Reuse
                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 650 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit