How to use the @google-cloud/vision.v1p2beta1 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.v1p2beta1.js View on Github external
function detectPdfText(bucketName, fileName) {
  // [START vision_async_detect_document_ocr]

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

  // 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';

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

  const inputConfig = {