2012-10-19 2 views
1

첫 번째 파일을 초과하여 업로드 된 파일에서 변환 스크립트가 실행되지 않는 이유는 무엇입니까?Alfresco에서 변환 스크립트 실행 중

Alfresco에서 폴더를 청취하는 변환 규칙을 설정했습니다. 새 파일이 폴더에 저장되면 규칙에 따라 텍스트 레이어없이 PDF를 가져 와서 jpeg로 분할하고 jpeg를 OCR 한 다음 jpeg를 PDF로 변환하고 PDF를 병합하여 OCR 된 PDF를 반환합니다. 그런 다음 텍스트 레이어를 사용하여 결과가 다른 폴더에 복사되므로 작업이 완료되었음을 알 수 있습니다.

명령 줄에서 스크립트를 실행하면 작동합니다. 처음 Alfresco 폴더에 파일을 놓으면 (업로드) 스크립트를 실행하고 파일을 복사합니다. 그러나 이후에 파일을 폴더에 놓으면 스크립트는 실행되지 않지만 파일은 여전히 ​​대상 폴더에 복사됩니다. 그래서 규칙이 호출되고 있지만 스크립트가 다음 파일에서 실행되지 않는 것 같습니다. 스크립트를 로깅했습니다. 그래서 스크립트가 호출되지 않습니다. 규칙이 필터가없는 폴더의 모든 신규 및 수정 된 파일에 적용됩니다. 그런 다음 사용자 지정 OCR 스크립트와 상위 폴더로 정의 된 대상 폴더를 사용하여 변환 및 복사 명령을 실행합니다.

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> 
<beans> 
    <bean id="transformer.worker.PdfOCRTool" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker"> 
    <property name="mimetypeService"> 
     <ref bean="mimetypeService"/> 
    </property> 
    <property name="transformCommand"> 
     <bean name="transformer.pdftoocr.Command" class="org.alfresco.util.exec.RuntimeExec"> 
     <property name="commandMap"> 
    <map> 
      <entry key=".*"> 
       <value>/opt/ocr/ocr.sh ${source} ${target}</value> 
      </entry> 
      </map> 
     </property> 
     <property name="errorCodes"> 
      <value>1,2</value> 
     </property> 
     </bean> 
    </property> 
    <property name="explicitTransformations"> 
     <list> 
     <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails"> 
      <property name="sourceMimetype"> 
      <value>application/pdf</value> 
      </property> 
      <property name="targetMimetype"> 
      <value>application/pdf</value> 
      </property> 
     </bean> 
     </list> 
    </property> 
    </bean> 

    <bean id="transformer.proxy.PdfOCRTool" class="org.alfresco.repo.management.subsystems.SubsystemProxyFactory"> 
    <property name="sourceApplicationContextFactory"> 
     <ref bean="thirdparty"/> 
    </property> 
    <property name="sourceBeanName"> 
     <value>transformer.worker.PdfOCRTool</value> 
    </property> 
    <property name="interfaces"> 
     <list> 
     <value>org.alfresco.repo.content.transform.ContentTransformerWorker</value> 
     </list> 
    </property> 
    </bean> 
    <bean id="transformer.PdfOCRTool" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer"> 
    <property name="worker"> 
     <ref bean="transformer.proxy.PdfOCRTool"/> 
    </property> 
    </bean> 
</beans> 
+0

규칙이 맞습니까? – Gagravarr

답변

0

변환 서비스가 다른 하나의 마임에서 항목을 변환하기위한 것입니다 :

다음은 내 야외 변환 확장입니다. PDF에서 두 번째 PDF 로의 변환이 유효한지 확신 할 수 없습니다. 사용자 정의 Java 저장소 작업을 구현하는 것이 더 좋을 것이며,이 작업은 차례로 org.alfresco.util.exec.RuntimeExec 빈을 사용하여 명령을 실행합니다.

여러분의 Spring 설정은 이미 RuntimeExec 빈을 정의하고 있으므로,이 정의를 다시 사용할 수 있지만, 확장자는 org.alfresco.repo.action.executer.ActionExecuterAbstractBase 인 자신 만의 맞춤 클래스로 감쌀 수 있습니다. 실제로 org.alfresco.repo.action.executer.TransformActionExecuter의 출처를 살펴보면 구현 방법에 대한 단서를 얻을 수 있습니다.

+0

당신은 나를 어떻게 말할 수 있습니까? 박쥐 file.I을 실행하는 데 org.alfresco.util.exec.RuntimeExec 클래스를 사용할 수 있습니다. 나는 abby ocr을 사용하고 있습니다. 동일한 시나리오입니다.하지만 javascript에서 실행하는 방법은 잘 모릅니다. –

관련 문제