File tree Expand file tree Collapse file tree 6 files changed +665
-2
lines changed
new-ocr-job-completed-instant Expand file tree Collapse file tree 6 files changed +665
-2
lines changed Original file line number Diff line number Diff line change 1+ import ocrspace from "../../ocrspace.app.mjs" ;
2+ import { axios } from "@pipedream/platform" ;
3+
4+ export default {
5+ key : "ocrspace-get-ocr-result" ,
6+ name : "Get OCR Result" ,
7+ description : "Retrieves the processed OCR result for a specific job ID. [See the documentation](https://ocr.space/ocrapi)" ,
8+ version : "0.0.{{ts}}" ,
9+ type : "action" ,
10+ props : {
11+ ocrspace,
12+ jobId : {
13+ propDefinition : [
14+ ocrspace ,
15+ "jobId" ,
16+ ] ,
17+ } ,
18+ } ,
19+ async run ( { $ } ) {
20+ const result = await this . ocrspace . retrieveOcrResult ( {
21+ jobId : this . jobId ,
22+ } ) ;
23+ $ . export ( "$summary" , `Retrieved OCR result for job ID ${ this . jobId } ` ) ;
24+ return result ;
25+ } ,
26+ } ;
Original file line number Diff line number Diff line change 1+ import ocrspace from "../../ocrspace.app.mjs" ;
2+ import { axios } from "@pipedream/platform" ;
3+
4+ export default {
5+ key : "ocrspace-process-image" ,
6+ name : "Process Image" ,
7+ description : "Submits an image file for OCR processing using OCR.space. [See the documentation](https://ocr.space/ocrapi)" ,
8+ version : "0.0.{{ts}}" ,
9+ type : "action" ,
10+ props : {
11+ ocrspace : {
12+ type : "app" ,
13+ app : "ocrspace" ,
14+ } ,
15+ imageUrl : {
16+ propDefinition : [
17+ "ocrspace" ,
18+ "imageUrl" ,
19+ ] ,
20+ } ,
21+ imageFile : {
22+ propDefinition : [
23+ "ocrspace" ,
24+ "imageFile" ,
25+ ] ,
26+ } ,
27+ imageLanguage : {
28+ propDefinition : [
29+ "ocrspace" ,
30+ "imageLanguage" ,
31+ ] ,
32+ optional : true ,
33+ } ,
34+ } ,
35+ async run ( { $ } ) {
36+ if ( ! this . imageUrl && ! this . imageFile ) {
37+ throw new Error ( "Either Image File URL or Image File Upload must be provided." ) ;
38+ }
39+
40+ const response = await this . ocrspace . submitImage ( {
41+ imageUrl : this . imageUrl ,
42+ imageFile : this . imageFile ,
43+ imageLanguage : this . imageLanguage ,
44+ } ) ;
45+
46+ const summary = response . JobId
47+ ? `Image submitted for OCR processing. Job ID: ${ response . JobId } `
48+ : "Image submitted for OCR processing." ;
49+
50+ $ . export ( "$summary" , summary ) ;
51+ return response ;
52+ } ,
53+ } ;
Original file line number Diff line number Diff line change 1+ import ocrspace from "../../ocrspace.app.mjs" ;
2+ import { axios } from "@pipedream/platform" ;
3+
4+ export default {
5+ key : "ocrspace-process-pdf" ,
6+ name : "Process PDF for OCR" ,
7+ description : "Submit a PDF for OCR processing. [See the documentation]()" ,
8+ version : "0.0.{{ts}}" ,
9+ type : "action" ,
10+ props : {
11+ ocrspace : {
12+ type : "app" ,
13+ app : "ocrspace" ,
14+ } ,
15+ pdfUrl : {
16+ propDefinition : [
17+ ocrspace ,
18+ "pdfUrl" ,
19+ ] ,
20+ } ,
21+ pdfFile : {
22+ propDefinition : [
23+ ocrspace ,
24+ "pdfFile" ,
25+ ] ,
26+ } ,
27+ pdfLanguage : {
28+ propDefinition : [
29+ ocrspace ,
30+ "pdfLanguage" ,
31+ ] ,
32+ optional : true ,
33+ } ,
34+ pdfPages : {
35+ propDefinition : [
36+ ocrspace ,
37+ "pdfPages" ,
38+ ] ,
39+ optional : true ,
40+ } ,
41+ } ,
42+ async run ( { $ } ) {
43+ const response = await this . ocrspace . submitPdf ( {
44+ pdfUrl : this . pdfUrl ,
45+ pdfFile : this . pdfFile ,
46+ pdfLanguage : this . pdfLanguage ,
47+ pdfPages : this . pdfPages ,
48+ } ) ;
49+
50+ const jobId = response . JobId || response . jobId || "N/A" ;
51+ $ . export ( "$summary" , `Submitted PDF for OCR processing. Job ID: ${ jobId } ` ) ;
52+ return response ;
53+ } ,
54+ } ;
You can’t perform that action at this time.
0 commit comments