@@ -635,7 +635,7 @@ async function detectFulltextGCS(bucketName, fileName) {
635
635
// [END vision_fulltext_detection_gcs]
636
636
}
637
637
638
- async function detectPdfText ( bucketName , fileName ) {
638
+ async function detectPdfText ( bucketName , fileName , outputPrefix ) {
639
639
// [START vision_text_detection_pdf_gcs]
640
640
641
641
// Imports the Google Cloud client libraries
@@ -651,9 +651,11 @@ async function detectPdfText(bucketName, fileName) {
651
651
// const bucketName = 'my-bucket';
652
652
// Path to PDF file within bucket
653
653
// const fileName = 'path/to/document.pdf';
654
+ // The folder to store the results
655
+ // const outputPrefix = 'results'
654
656
655
657
const gcsSourceUri = `gs://${ bucketName } /${ fileName } ` ;
656
- const gcsDestinationUri = `gs://${ bucketName } /${ fileName } .json ` ;
658
+ const gcsDestinationUri = `gs://${ bucketName } /${ outputPrefix } / ` ;
657
659
658
660
const inputConfig = {
659
661
// Supported mime_types are: 'application/pdf' and 'image/tiff'
@@ -870,10 +872,10 @@ require(`yargs`) // eslint-disable-line
870
872
opts => detectFulltextGCS ( opts . bucketName , opts . fileName )
871
873
)
872
874
. command (
873
- `pdf <bucketName> <fileName>` ,
875
+ `pdf <bucketName> <fileName> <outputPrefix> ` ,
874
876
`Extracts full text from a pdf file` ,
875
877
{ } ,
876
- opts => detectPdfText ( opts . bucketName , opts . fileName )
878
+ opts => detectPdfText ( opts . bucketName , opts . fileName , opts . outputPrefix )
877
879
)
878
880
. command (
879
881
`localize-objects <fileName>` ,
@@ -909,7 +911,7 @@ require(`yargs`) // eslint-disable-line
909
911
. example ( `node $0 web-geo-gcs my-bucket your-image.jpg` )
910
912
. example ( `node $0 fulltext ./resources/wakeupcat.jpg` )
911
913
. example ( `node $0 fulltext-gcs my-bucket your-image.jpg` )
912
- . example ( `node $0 pdf my-bucket my-pdf.pdf` )
914
+ . example ( `node $0 pdf my-bucket my-pdf.pdf results ` )
913
915
. example ( `node $0 localize-objects ./resources/duck_and_truck.jpg` )
914
916
. example ( `node $0 localize-objects-gcs gs://bucket/bucketImage.png` )
915
917
. wrap ( 120 )
0 commit comments