Archive for March 2010
I needed to convert scanned pdf into any image format so that I can run OCR operation for one of the DMS solutions I am working on. Actually I am using Tesseract (Open source OCR solution from Google) for OCR and it only takes image format as input. After spending few hours searching and trying few solution I zeroed in on this codeproject article which is making use of Ghostscript to achieve the core functionality.
So far this is the only solution I think works seamlessly on most windows platforms including Win7 (already tested on XP, Win2003, Win7).
Accessing files and other resources on network from within code is achieved in following way in C# (of course there are other ways but this seems neat):
Take following assembly reference first:
[DllImport(“advapi32.dll”, SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
Private void YourFunction()
IntPtr tokenHandle = new IntPtr(0);
bool returnValue = LogonUser(f.cUserName, f.cDomain, f.cPassword, 2, 0, ref tokenHandle);
WindowsIdentity ImpersonatedIdentity = new WindowsIdentity(tokenHandle);
WindowsImpersonationContext MyImpersonation = ImpersonatedIdentity.Impersonate();
wic = MyImpersonation;
// do some file IO activity here on server…
I have a huge collection of mp3 music files and locating music was bit difficult if I would like to hear a particular artist, I quickly tried to search on google , found some programs but unnecessarily complex, so I wrote my own , which is very simple. it does following:
- Asks for a target directory where your mp3 files are located.
- On click of a button it extracts the meta info and organizes the files in folders per artist.
It’s very basic but useful to me at least. you are free to modify/use/distribute at your own risk 🙂