This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, June 16, 2008 1:25:46 AM(UTC)
Groups: Registered
Posts: 10
Hello
I bet I've forgotten to do some basic configuration - but I have searched the LeadTools chm files, Googled extensively, and searched this forum and come up with nothing.
I'm using LeadTools 15 Raster Image Pro - evaluation.
How do I load a .txt (plain non-Unicode ASCII text) file - without getting an Invalid File Format error.
I can't even do a LFile.GetInfo() - get the same error.
My ultimate aim is to render the txt file as a bitmap.
Here's my code
<code>
LBase::LoadLibraries(LT_KRN | LT_FIL); // Does nothing if they are already loaded.
L_TCHAR *filename = "some file name.txt";
LFile LeadFile;
LeadFile.SetFileName(filename);
FILEINFO fileInfo;
ZeroMemory(&fileInfo, sizeof(FILEINFO));
fileInfo.uStructSize = sizeof(FILEINFO);
L_INT nSuccess = LeadFile.GetInfo(&fileInfo, sizeof(FILEINFO), FILEINFO_TOTALPAGES);
</code>
nSuccess has value -9.
Similarly:
<code>
LBitmap lb;
nSuccess = lb.Load(filename, 0, ORDER_BGRORGRAY, nPage);
</code>
If I try this I get a slightly different error code -2002 (invalid parameters):
<code>
LFile rawfile;
rawfile.SetFileName(filename);
nSuccess = rawfile.LoadFile(0, ORDER_RGB, LOADFILE_ALLOCATE | LOADFILE_STORE);
</code>
So what have I forgotten to do????
#2
Posted
:
Monday, June 16, 2008 6:28:34 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Please make sure that the Lftxt15u.dll DLL exist in the same folder where you deploy the Ltfil15u.dll.
#3
Posted
:
Monday, June 16, 2008 11:34:33 PM(UTC)
Groups: Registered
Posts: 10
Hi
I have installed the SDK on my PC as I'm still in the development phase. Both dlls are in the same directory D:\Program Files\LEAD Technologies\LEADTOOLS Class Library EVAL 15\Bin\API\Win32\
So it must be something else. None of the LeadTools examples seem to load txt files either.
There must be something else I've missed.
Thanks
Jordan
#4
Posted
:
Tuesday, June 17, 2008 4:24:37 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Jordan,
Before loading the TXT files, you need to use the LFileSettings::SetTXTOptions
and set the options for loading your file. This is shown in our Main C++ Class
library demo:
LEADTOOLS 15\EXAMPLES\CLASSLIBRARY\MSVC\MainDemo
You can find it in "Demo.cpp" file inside
the 'void CDemo::OnPreferencesLoadtextfiles()' function.
#5
Posted
:
Tuesday, June 17, 2008 6:46:11 AM(UTC)
Groups: Registered
Posts: 10
Hello Adnan
Yep, that did the trick.
One comment though. The Main Demo does this
L_INT nRet;
FILETXTOPTIONS TxtOptions;
nRet = LFileSettings::GetTXTOptions( &TxtOptions, sizeof( TxtOptions ) );
if( SUCCESS == nRet )
{
TxtOptions.bEnabled = !(TxtOptions.bEnabled);
LFileSettings::SetTXTOptions( &TxtOptions );
}
and doesn't see to need to set teh size of TxtOptions.uStructSize
However if I do this nRet = 0. So I end up having to do this:
FILETXTOPTIONS TxtOptions;
ZeroMemory(&TxtOptions, sizeof(TxtOptions));
TxtOptions.uStructSize = sizeof(TxtOptions);
L_INT nRet = LFileSettings::GetTXTOptions(&TxtOptions, sizeof(TxtOptions));
if(SUCCESS == nRet)
{
TxtOptions.bEnabled = L_TRUE;
LFileSettings::SetTXTOptions(&TxtOptions);
}
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.