mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-12-06 03:01:56 +00:00
--------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Christoph Schlaepfer <1939311+Anuril@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: stumpylog <797416+stumpylog@users.noreply.github.com> Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: OpenAI Codex <codex@openai.com>
31 lines
827 B
TypeScript
31 lines
827 B
TypeScript
import { Injectable } from '@angular/core'
|
|
import { Observable } from 'rxjs'
|
|
import {
|
|
OcrTemplate,
|
|
OcrZoneTestResult,
|
|
ZoneTestRequest,
|
|
} from '../../data/ocr-template'
|
|
import { AbstractPaperlessService } from './abstract-paperless-service'
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class OcrTemplateService extends AbstractPaperlessService<OcrTemplate> {
|
|
constructor() {
|
|
super()
|
|
this.resourceName = 'ocr_templates'
|
|
}
|
|
|
|
getPageImageUrl(docId: number, page: number): string {
|
|
return `${this.baseUrl}${this.resourceName}/document-page-image/${docId}/${page}/`
|
|
}
|
|
|
|
testZone(
|
|
docId: number,
|
|
zone: ZoneTestRequest
|
|
): Observable<OcrZoneTestResult> {
|
|
return this.http.post<OcrZoneTestResult>(
|
|
`${this.baseUrl}${this.resourceName}/test-zone/`,
|
|
{ document: docId, zone }
|
|
)
|
|
}
|
|
}
|