{"id":2420,"date":"2017-07-05T21:49:37","date_gmt":"2017-07-05T21:49:37","guid":{"rendered":"http:\/\/www.gssezisoft.com\/main\/?p=2420"},"modified":"2017-07-05T21:49:37","modified_gmt":"2017-07-05T21:49:37","slug":"flatbed-scanners-and-multiple-pages","status":"publish","type":"post","link":"http:\/\/www.gssezisoft.com\/main\/2017\/07\/flatbed-scanners-and-multiple-pages\/","title":{"rendered":"Flatbed Scanners and Multiple Pages"},"content":{"rendered":"<p>It is pretty easy to scan a series of pages into a single PDF file if you&#8217;ve got a document feeder. It isn&#8217;t so easy to deal with flatbed scanners and multiple pages. Here&#8217;s how it&#8217;s done <!--more--><\/p>\n<p>The program below is a VBscript file so save it with a &#8220;.vbs&#8221; extension and then double-click it to run it.<\/p>\n<p>It creates a temporary directory, scans pages into the directory until you tell it you&#8217;re finished, then it puts all the pages together into a PDF file. It allows you to work with flatbed scanners and multiple pages.<\/p>\n<p>When you run it, it looks like this:<br \/>\n<img loading=\"lazy\" src=\"http:\/\/www.gssezisoft.com\/main\/wp-content\/uploads\/2017\/07\/2017070601-gss-scan-multiple-pages.png\" alt=\"using flatbed scanners and multiple pages\" width=\"251\" height=\"155\" class=\"alignnone size-full wp-image-2422\" srcset=\"http:\/\/www.gssezisoft.com\/main\/wp-content\/uploads\/2017\/07\/2017070601-gss-scan-multiple-pages.png 251w, http:\/\/www.gssezisoft.com\/main\/wp-content\/uploads\/2017\/07\/2017070601-gss-scan-multiple-pages-150x93.png 150w\" sizes=\"(max-width: 251px) 100vw, 251px\" \/><\/p>\n<p>You end up with a file called pages.pdf in the current directory. This should be moved or renamed before you scan your next set of multiple pages (or it&#8217;ll get overwritten).<\/p>\n<p>The program assumes you have a modern, 64 bit computer or laptop and that <a href=\"http:\/\/www.gssezisoft.com\/main\/cmdtwain\/\">CmdTwain<\/a> has been installed in the &#8220;C:\\Program Files (x86)\\GssEziSoft\\CmdTwain&#8221; directory. If that&#8217;s not the case you&#8217;ll need to adjust that line below.<\/p>\n<p><code><\/p>\n<pre>\r\n\r\nDim SH, FSO\r\nSet SH  = WScript.CreateObject(\"WScript.Shell\")\r\nSet FSO = CreateObject(\"Scripting.FileSystemObject\") \r\n\r\ndbg    = false   ' debug: true or false\r\nprog   = \"C:\\Program Files (x86)\\GssEziSoft\\CmdTwain\"\r\n\r\nmain\r\n\r\nsub main ()\r\n    dim tempDir, outFn, tab, lf, msg, i, ok\r\n\r\n    tab    = chr(9)\r\n    lf     = chr(10)\r\n    tempDir= \"temp1246\"\r\n    outFn  = \"pages.pdf\"\r\n\r\n    if FSO.FolderExists(tempDir) then\r\n        msg = \"WARNING.\" & lf\r\n        msg = msg & \"All files in \" & tempDir & \" will be deleted.\" & lf & lf\r\n        msg = msg & \"Proceed anyway?\"\r\n        ok= MsgBox(msg,vbYesNo,\"Temporary Directory Exists\")\r\n        if ok = vbNo then exit sub\r\n        FSO.DeleteFolder tempDir\r\n    end if\r\n    FSO.CreateFolder(tempDir)\r\n\r\n    for i=1 to 500\r\n        ScanPage i, tempDir\r\n        ok= MsgBox(\"Scan another page?\",vbYesNo,\"Scanning Pages\")\r\n        if ok = vbNo then exit for\r\n    next\r\n    ConvertToPdf tempDir, outFn\r\n\r\n    If not dbg then FSO.DeleteFolder tempDir '  clean up afterwards\r\nend sub\r\n\r\nsub ScanPage(pNum,pDir)\r\n    dim fn, cmd\r\n\r\n    fn = \"page\" & mid(\"\" & (1000+pNum),2,3) & \".jpg\"\r\n    cmd= \"\"\"\" & prog & \"\\cmdtwain.exe\"\"\"\r\n    cmd= cmd & \" -c \"\"A4 300 COLOR\"\" 75 \"\"\" & pDir & \"\\\" & fn & \"\"\"\"\r\n    SH.Run cmd,1,true ' normal window type, wait\r\n\r\nend sub\r\n\r\nsub ConvertToPdf(pDir,pOutFn)\r\n    dim cmd\r\n\r\n    cmd= \"\"\"\" & prog & \"\\jpg2pdf.exe\"\"\"\r\n    cmd= cmd & \" -c \"\"A4\"\" \" & pDir & \"\\page*.jpg \" & pOutFn\r\n    SH.Run cmd,1,true ' normal window type, wait\r\n\r\nend sub\r\n\r\n<\/pre>\n<p><\/code><\/p>\n<p>I hope you find it helpful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is pretty easy to scan a series of pages into a single PDF file if you&#8217;ve got a document feeder. It isn&#8217;t so easy to deal with flatbed scanners and multiple pages. Here&#8217;s how it&#8217;s done<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,7,38,40],"tags":[],"_links":{"self":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/posts\/2420"}],"collection":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/comments?post=2420"}],"version-history":[{"count":3,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/posts\/2420\/revisions"}],"predecessor-version":[{"id":2424,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/posts\/2420\/revisions\/2424"}],"wp:attachment":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/media?parent=2420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/categories?post=2420"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/tags?post=2420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}