| 662 | } |
| 663 | |
| 664 | async function detectFulltextGCS(bucketName, fileName) { |
| 665 | // [START vision_fulltext_detection_gcs] |
| 666 | |
| 667 | // Imports the Google Cloud client libraries |
| 668 | const vision = require('@google-cloud/vision'); |
| 669 | |
| 670 | // Creates a client |
| 671 | const client = new vision.ImageAnnotatorClient(); |
| 672 | |
| 673 | /** |
| 674 | * TODO(developer): Uncomment the following lines before running the sample. |
| 675 | */ |
| 676 | // const bucketName = 'Bucket where the file resides, e.g. my-bucket'; |
| 677 | // const fileName = 'Path to file within bucket, e.g. path/to/image.png'; |
| 678 | |
| 679 | // Read a remote image as a text document |
| 680 | const [result] = await client.documentTextDetection( |
| 681 | `gs://${bucketName}/${fileName}` |
| 682 | ); |
| 683 | const fullTextAnnotation = result.fullTextAnnotation; |
| 684 | console.log(fullTextAnnotation.text); |
| 685 | // [END vision_fulltext_detection_gcs] |
| 686 | } |
| 687 | |
| 688 | async function detectPdfText(bucketName, fileName, outputPrefix) { |
| 689 | // [START vision_text_detection_pdf_gcs] |