2016-10-20 3 views
0

폴더 내의 PDF가 유효한 PDF/A 파일인지 처리하고 확인하려고합니다. 문제는 단어가 포함 된 파일 더미가있는 폴더를 처리해야하고 프리 플라이트가 PDF, 프로세스로 변환 한 다음 사용자 입력에 응답하여 파일을 삭제한다는 것입니다. 수백 개의 파일이 있으므로 사용자 입력을 기다리는 것이 불가능합니다.Acrobat DC 프리 플라이트가 PDF가 아닌 파일을 처리합니다.

아마도 내가 검색 할 때 올바른 구문을 사용하지 않고 있지만 Adobe Acrobat DC가 PDF 파일 만 처리하도록하는 방법을 찾을 수 없습니다. Acrobat X에서 소스 파일 https://www.evermap.com/ActionWizardX.asp을 지정할 수 있지만 DC에서 해당 파일을 찾을 수 없음을 발견했습니다.

PDF 파일 만 처리하도록 조치 할 수있는 방법이 있습니까?


편집

: @Joel Geraci의 제안과 this post을 찾는 다음

, 나는 작업에서 실행되는 다음과 같은 스크립트를 만들었습니다. 이 시점에서 프로필을 실행하는 것 같지만 실제로 this.closeDoc()을 호출하면 문서를 저장하라는 메시지가 표시되지 않고 결과 문서가 다음과 같이 저장되지 않은 것 같습니다. PDF/A 파일.

/* Convert PDF/A-3a */ 
try 
{ 
    if(this.path.split('.').pop() === 'pdf') 
    { 
    var oProfile = Preflight.getProfileByName("Convert to PDF/A-3a"); 

    if(oProfile != undefined) 
    { 
     var myPreflightResult = this.preflight(oProfile); 
     console.println("Preflight found " + myPreflightResult.numErrors + " Errors."); 
     console.println("Preflight found " + myPreflightResult.numWarnings + " Warnings."); 
     console.println("Preflight found " + myPreflightResult.numInfos + " Infos."); 
     console.println("Preflight fixed " + myPreflightResult.numFixed + " Errors."); 
     console.println("Preflight not fixed " + myPreflightResult.numNotFixed + " Errors."); 
     this.closeDoc(); 
    } 
    } 
} 
catch(theError) 
{ 
    $error = theError; 
    this.closeDoc({bNoSave : true}); 
} 

편집 2 : 나는 saveAs 기능을 사용하여 정착 결국

. XML 데이터를 파일로 내보내는 방법을 모르겠지만 이것이 충분할 것 같습니다.

/* Convert PDF/A-3a */ 
try 
{ 
    if(this.path.split('.').pop() === 'pdf') 
    { 
    var oThermometer = app.thermometer; 
    var oProfile = Preflight.getProfileByName("Convert to PDF/A-3a"); 

    if(oProfile != undefined) 
    { 
     var myPreflightResult = this.preflight(oProfile, false, oThermometer); 
     console.println("Preflight found " + myPreflightResult.numErrors + " Errors."); 
     console.println("Preflight found " + myPreflightResult.numWarnings + " Warnings."); 
     console.println("Preflight found " + myPreflightResult.numInfos + " Infos."); 
     console.println("Preflight fixed " + myPreflightResult.numFixed + " Errors."); 
     console.println("Preflight not fixed " + myPreflightResult.numNotFixed + " Errors."); 
     if(myPreflightResult.numErrors > 0) { 
     var cXMLData = myPreflightResult.report(oThermometer); 
     console.println(cXMLData); 
     } 
     this.saveAs(path,"com.callas.preflight.pdfa"); 
    } 
    } 
} 
catch(theError) 
{ 
    $error = theError; 
    this.closeDoc({bNoSave : true}); 
} 

편집 3 :

그래서 문제는 내 자바 스크립트가 실행되기 전에 비 PDF 파일이 this.path.split('.').pop() === 'pdf' 실제로 아무것도 필터링하지 않음을 의미하는 변환 읽을 것입니다. Doc 클래스의 requiresFullSave 속성이 문서가 임시 파일인지 여부를 지정합니다. 그러나 나는 임시 파일을 저장할지 묻는다는 것을 알았지 만 도움이되지 않습니다. 임시 파일에 Doc.closeDoc(true)를 호출

편집 4

는 Acrobat에서 충돌하고 저장하지 않고 문서를 닫을 수있는 또 다른 방법이있을 것 같지 않습니다됩니다. 나는 사용자에게 저장하라는 메시지를 표시하지 않고 임시 문서를 닫고 PDF가 아닌 파일을 모두 삭제하는 데 분명한 방법이 없다는 것을 발견했다.

최종 스크립트 :

/* Convert PDF/A-3a */ 
try 
{ 
    console.println(path + " is temp: " + requiresFullSave); 
    if(!requiresFullSave) 
    { 
    var oThermometer = app.thermometer; 
    var oProfile = Preflight.getProfileByName("Convert to PDF/A-3a"); 

    if(oProfile != undefined) 
    { 
     var myPreflightResult = this.preflight(oProfile, false, oThermometer); 
     console.println("Preflight found " + myPreflightResult.numErrors + " Errors."); 
     console.println("Preflight found " + myPreflightResult.numWarnings + " Warnings."); 
     console.println("Preflight found " + myPreflightResult.numInfos + " Infos."); 
     console.println("Preflight fixed " + myPreflightResult.numFixed + " Errors."); 
     console.println("Preflight not fixed " + myPreflightResult.numNotFixed + " Errors."); 
     if(myPreflightResult.numErrors > 0) { 
     var cXMLData = myPreflightResult.report(oThermometer); 
     console.println(cXMLData); 
     } 
     this.saveAs(path,"com.callas.preflight.pdfa"); 
    } 
    } 
    else{ 
    // As noted in the documentation found [here][2] 
    // Note:If the document is temporary or newly created, setting dirty to false has no effect. That is, the user is still asked to save changes before closing the document. See requiresFullSave. 
    // this.dirty = false; 
    // this.closeDoc(true); 
    } 
} 
catch(theError) 
{ 
} 

답변

1

오히려 프리 플라이트 실행하는 활동을 만드는 것보다, 약간의 자바 스크립트를 실행하는 작업을 만들어보십시오. JavaScript는 처리되는 파일의 파일 확장자를 테스트 한 다음 PDF 인 경우 JavaScript를 통해 프리 플라이트를 실행하고 그렇지 않은 경우 건너 뜁니다.

+0

성공하면 PreflightProfile을 실행 한 문서를 제자리에 저장하는 방법을 알고 있습니까? – Nielsvh

+1

가장 쉬운 방법은 ... app.execMenuItem ("저장"); 아래 URL의 주제에 대한 훌륭한 기사가 있습니다. https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript – joelgeraci

관련 문제