시나리오
당신은 웹 페이지의 웹 페이지에서 스캐너, 문서 스캔을 연결합니다. 여러 문서를 한 번 스캔 할 때, 거기에 각 문서 사이를 분리하는 빈 페이지가, 당신은 완전히 스캔 한 후 문서의 각 부분에 개별적으로 문서를 저장할.
솔루션
사용하는 동적 웹 TWAIN SDK는 신속하게 빈 페이지 문서 분리를 사용하여 페이지의 문서 스캔을 달성 할 수있다.
구현 단계
1 단계 : 다운로드 및 설치 동적 웹 TWAIN 30 일 무료 평가판
응용 프로그램의 다운로드 링크 : https://www.damingsoft.com/products/dwt-register.aspx
2 단계 : 빌드 웹 페이지를 스캔 한 페이지
설치가 C에 완료가되면 : \ Program 파일 (x 86) \ Dynamsoft \ 동적 웹 TWAIN SDK는 {버전} 시험은 샘플의 UseEvent.html을 찾을 \ \ 샘플 페이지에서 시작하기. 가장 간단한 웹 페이지 검색을 달성하기 위해 열려면 두 번 클릭합니다.
당신은 자신에게 웹 페이지 검색을 구축하려면 설명서를 참조하십시오 https://www.damingsoft.com/docs/dwt/Dev-Guide/Build-the-Hello-World-Scan-Page.html
3 단계 : 빈 페이지를 결정하고 문서를 저장
이를 위해, 우리는 인터페이스 사용하는 모든 문서를 스캔합니다 IsBlankImageExpress (인덱스) 가 비어 있는지 여부를 감지 할 수 있습니다. 페이지가 비어 있으면, 우리는 그것을 제거하고 문서 세트에 버퍼를 저장합니다. 이 작업을 수행하기 위해, 우리는이 빈 페이지가 있는지, 모든 후, 검사가 완료 트리거 이벤트 OnPostAllTransfers을 사용합니다.
이 시점에서, 우리는 UseEvent.html를 열 수 있습니다, 그 코드는 거의 변화가있을 것입니다. 다음 함수 Dynamsoft_OnReady 변경은 :
function Dynamsoft_OnReady() {
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
//DWObject.Width = 270; // Set the width of the Dynamic Web TWAIN Object
//DWObject.Height = 400; // Set the height of the Dynamic Web TWAIN Object
if (DWObject) {
DWObject.RegisterEvent('OnPostAllTransfers', CheckBlankPage); // Register OnPostAllTransfers event. This event fires when all pages have been scanned and transferred
}
}
기능 CheckBlankPage 추가 :
function CheckBlankPage() { //Function for checking a blank page, called when OnPostAllTransfers is triggered
if (DWObject) {//Ensure there is a DWObject
var startindex = 0;
for (var i = 0; i < DWObject.HowManyImagesInBuffer; i++) {//Go through each image in the buffer.
if (DWObject.IsBlankImageExpress(i)) {
DWObject.RemoveImage(i);// remove the blank page from the buffer.
if (i != 0) {
i--; //decrement i for the removed image
DWObject.SelectedImagesCount = (i - startindex + 1); // set how many images are selected
for (var j = 0; j < DWObject.SelectedImagesCount; j++) { //loop to select all images from previous blank to current
DWObject.SetSelectedImageIndex(j, j + startindex);
}
if (DWObject.SelectedImagesCount > 0) { //save images as long as there are some in the selection
DWObject.IfShowFileDialog = true;
var randomId = (Math.floor(Math.random() * 1000 + 1)).toString();
DWObject.SaveSelectedImagesAsMultiPagePDF(randomId + ".pdf");//PLEASE CHANGE THIS FILE PATH
}
startindex = i + 1; //set the start index for next search 1 higher than current page
}
}
else if (i == DWObject.HowManyImagesInBuffer - 1) {//the last few images are not blank
DWObject.SelectedImagesCount = (i - startindex + 1); // set how many images are selected
for (var j = 0; j < DWObject.SelectedImagesCount; j++) { //loop to select all images from previous blank to current
DWObject.SetSelectedImageIndex(j, j + startindex);
}
if (DWObject.SelectedImagesCount > 0) { //save images as long as there are some in the selection
DWObject.IfShowFileDialog = true;
DWObject.SaveSelectedImagesAsMultiPagePDF("AllInOne.pdf");//PLEASE CHANGE THIS FILE PATH
}
}
}
}
}
응용 프로그램이 빈 페이지 (일부 비 화이트 포인트의 가장자리 주위에 빈 페이지)를 감지하기 어려운 경우 당신이 컬러 페이지를 사용하는 경우, 또는, 당신은 페이지의 표준 편차를 사용해야 할 수도 있습니다. 대신 다음과 같은 코드를 사용할 수 있습니다 :
function CheckBlankPage(){ //Function for checking a blank page, called when OnPostAllTransfers is triggered
if(DWObject){//Ensure there is a DWObject
for(var i = 0; i < DWObject.HowManyImagesInBuffer;i++){//Go through each image in the buffer.
if(DWObject.IsBlankImageExpress(i)){}//Make Blank Image run, but do not use the result
if(DWObject.BlankImageCurrentStdDev < 15.0){//set a standard deviation for the program to use
//...... same as above code
}
}
}
}
개요
위의 방법을 통해, 당신은 쉽게 페이지 문서 스캔을 달성, 문서 문서 분리 사이의 빈 페이지를 사용할 수 있습니다.
물론, 별도의 문서에 대한 몇 가지 애플리케이션 시나리오는 문서에 빈 페이지에 서명 아닌 바코드 또는 두 개의 차원 코드. 이것은 하나의 문서 분리 방법이며, 동적 웹 TWAIN 및 추가 기능 바코드 리더를 통해 달성 될 수있다. 우리는 기사 이후에 소개합니다.