Dan Matis ask me to create a “Scan to PDF” function based on the work I had previously done on my image viewer component, and he is gracious enough to allow me to share the function with the community. You simply pass the name of the resulting PDF file to the function, and it uses the WX twain commands to perform the scan and then a few tricks to create a PDF from the scan. All pure WX code.
We will be covering:
- WinDev Native Twain Functions
- Using Images on Reports
- Nested Reports
- Generating reports directly to PDF
- In the coming weeks I will create an external component and release it as part of the open source suite.
Background
Back in the dark ages of wxLive, I did a webinar showing my ImageViewer external component, it used all Native WX commands and its intention is to be used as an interface for document storage integration with your WinDev applications. The challenge of document storage is dealing with multiple page image files. And although the component works, there were issues with rotating the images that I was not able to get around with native functions and other function dealing with multiple page TIF files such as splitting, inserting pages, deleting pages, that were not available or difficult. And since my bank client has over 6 terabytes of existing TIF files, I eventually used an ActiveX from Viscom Soft as the basis of much of the Image Viewer component that I have in production.
All that being said, to explain that there are certain was this app is coded, such as using nest reports, not deleting the temporary images until the next run, etc., that were done because of specific issues we ran into in production. If I deleted the code while generating the report, I would occasionally get blank pages, or the same page repeating, I believe this was mainly because they would preview the report, and then print it, which if you are not aware cause WD to regenerate the report. I also had random issues with the same page being repeated, or cut off in the report, and creating the nested report approach solved those issues. So you might be able to change this around and make it a little more efficient, be sure to test it thoroughly before putting into production as there are some oddities when dealing with reports and images, but again that may just be because we were dealing with multiple page TIF files.
So on with the Show!
WinDev Native Twain Functions
Be sure to go over to wxLive.us and watch the Uncle Pete’s corner webinar that is the companion to this article.
Uncle Pete’s Corner is weekly webinar on all things WX every Friday 7:15 AM CST (5:15 PST), to watch the recorded version of this webinar, many other WX related webinars or to watch future ones live go to wxLive.us
[suffusion-the-author display=’author’]
[suffusion-the-author display=’description’]