How to use the @google-cloud/vision.v1 function in @google-cloud/vision

To help you get started, we’ve selected a few @google-cloud/vision examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-vision / samples / detect.js View on Github external
async function detectPdfText(bucketName, fileName, outputPrefix) {
  // [START vision_text_detection_pdf_gcs]

  // Imports the Google Cloud client libraries
  const vision = require('@google-cloud/vision').v1;

  // Creates a client
  const client = new vision.ImageAnnotatorClient();

  /**
   * TODO(developer): Uncomment the following lines before running the sample.
   */
  // Bucket where the file resides
  // const bucketName = 'my-bucket';
  // Path to PDF file within bucket
  // const fileName = 'path/to/document.pdf';
  // The folder to store the results
  // const outputPrefix = 'results'

  const gcsSourceUri = `gs://${bucketName}/${fileName}`;
  const gcsDestinationUri = `gs://${bucketName}/${outputPrefix}/`;