Documentation Index Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
Use this file to discover all available pages before exploring further.
이 인터페이스는 FRDocument 객체의 이벤트를 리스너에 보고하는 데 사용되는 콜백 인터페이스입니다. 이 인터페이스는 클라이언트 측에서 구현됩니다. 개발 도구별 자세한 구현 지침은 Working with Connectable Objects 를 참조하세요. 간단한 설명은 다음과 같습니다.
C++ 사용자는 IFRDocumentEvents 인터페이스를 구현하고, 연결 지점(Windows)을 가져온 다음, 해당 인터페이스를 구현하는 객체를 FRDocument 객체에 “advice”해야 합니다. 이 인터페이스는 IUnknown 인터페이스에서 파생되므로 클라이언트 객체도 IUnknown 메서드를 구현해야 합니다.
FRDocument 객체에서 알림을 받으려는 Visual Basic 사용자는 이를 WithEvents로 선언하고, 다음과 유사한 프로시저를 구현해야 합니다.
Public WithEvents doc As FREngine . FRDocument
Private Sub doc_OnPageProcessed ( ByVal sender As FRDocument , _
ByVal index As Integer , _
ByVal stage As PageProcessingStageEnum )
...
End Sub
이 인터페이스의 메서드를 통해 알림을 받는 객체는 메서드 구현 내부에서 다음 작업을 수행할 수 있습니다:
이미지 로드, 문서 분석, 인식, 합성 및 내보내기의 진행률(백분율)을 보고합니다.
완료된 문서 분석, 인식, 합성 및 내보내기에 대한 정보를 보고합니다.
Windows: 긴 작업 중 애플리케이션이 응답하지 않는 것처럼 보이지 않도록 시스템 메시지를 처리합니다. 이는 사용자 인터페이스가 있는 애플리케이션에서 유용할 수 있습니다.
이름 설명 OnPageProcessed 페이지 처리가 완료되었을 때 관련 정보를 클라이언트에 전달합니다. OnProgress 현재 작업(이미지 로드, 분석, 인식 등)의 대략적인 진행률 정보를 클라이언트에 전달합니다. OnWarning 처리 중 발생한 팁 및 경고 메시지를 클라이언트에 전달합니다.
이 Windows C++ 샘플은 메서드 호출이 너무 오래 걸리는 경우 처리를 중단하도록 타이머를 구현하는 방법을 보여줍니다.
class CFRDocumentCallback : public IFRDocumentEvents {
public:
CFRDocumentCallback () : startTime ( 0 ) {}
// IUnknown 메서드를 구현합니다
ULONG STDMETHODCALLTYPE AddRef () { return 1 ; }
ULONG STDMETHODCALLTYPE Release () { return 1 ; }
HRESULT STDMETHODCALLTYPE QueryInterface ( REFIID riid, void ** ppObject );
HRESULT STDMETHODCALLTYPE OnProgress ( IFRDocument * document, int percentage, VARIANT_BOOL * ShouldContinue );
HRESULT STDMETHODCALLTYPE OnWarning ( IFRDocument * document, int pageNumber, BSTR recognizerTip,
VARIANT_BOOL * ShouldContinue );
HRESULT STDMETHODCALLTYPE OnPageProcessed ( IFRDocument * document, int pageNumber, PageProcessingStageEnum stage );
void FlushTimer ();
void SetShouldTrackTime ( bool _shouldTrackTime );
private:
time_t startTime;
bool shouldTrackTime = true ;
};
// startTime을 재설정하려면 FlushTimer 메서드를 호출합니다
void CFRDocumentCallback :: FlushTimer () {
time ( & startTime );
}
// 이 콜백은 다른 메서드에서도 사용할 수 있으므로,
// 더 이상 시간 초과를 사용하지 않으려면 shouldTrackTime을 FALSE로 설정합니다
void CFRDocumentCallback :: SetShouldTrackTime ( bool _shouldTrackTime ) {
shouldTrackTime = _shouldTrackTime;
}
// 현재 시간과 "startTime"의 차이가 특정 임계값을 초과하면
// 처리가 중단됩니다
HRESULT STDMETHODCALLTYPE CFRDocumentCallback :: OnProgress ( IFRDocument * frDocument,
int percentage, VARIANT_BOOL * shouldTerminate )
{
if ( shouldTrackTime ) {
time_t currentTime;
time ( ¤tTime );
double seconds = difftime ( currentTime, startTime );
printf ( " %f \n " , seconds );
* shouldTerminate = ( seconds > 100 ? VARIANT_TRUE : VARIANT_FALSE );
}
return S_OK;
}
이 객체는 다음 코드 샘플에서 사용됩니다: EventsHandling (Windows 및 Linux).
Linux에서는 Engine 객체가 외부 프로세스 서버로 로드된 경우 이 인터페이스가 작동하지 않습니다.
FRDocument
Working with Connectable Objects