How to convert DOS-TXT file OEM-866 (Rus) in doc?
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
How to convert DOS-TXT file OEM-866 (Rus) in doc?
How to convert DOS-TXT file OEM-866 (Rus) to doc in Alaska?
- Attachments
-
- 134-001 Луценко Е.В.zip
- (1.82 KiB) Downloaded 775 times
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
How to convert DOS-TXT file OEM-866 (Rus) to doc-file or pdf-file in Alaska?
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
Hi Eugene
I am also converting TXT files in CP 852 Latin2 (DOS) to PDF,
First I convert file from ANSI to OEM coding:
FUNCTION KONV_ANSI2OEM // konverzia súboru z ANSI do OEM
LOCAL outriadok:=""
LOCAL nSource18,nTarget18
PARAMETERS infile,outfile
IF ( nSource18 := FOpen( infile, FO_READ ) ) == -1
DC_Impl(cCakaj)
oznam2("Vstupný súbor sa nedá otvoriť:",infile)
return(.F.)
ENDIF
velkostsuboru:=filesize(infile)
cSourceString := Space( velkostsuboru )
nBytes := velkostsuboru
zostatok:=velkostsuboru
nSourcestring := FRead( nSource18, @cSourceString, velkostsuboru )
FClose( nSource18 )
IF ( nTarget18 := FCreate( outfile, FC_NORMAL ) ) == -1
DC_Impl(cCakaj)
oznam2("Výstupný súbor sa nedá otvoriť:",outfile)
return(.F.)
ENDIF
outriadok:=convtooemcp(cSourcestring) // samotná konverzia
FWrite( nTarget18,outriadok)
FClose( nTarget18 )
RETURN(0)
You can examine also convtoansicp() function, but for me works right convtooemcp
Then I write to PDF with PDF Creator
* set options for generate PDF report
DCPRINT OPTIONS TO aOptions NAME 'RauknReport' ;
BUSYMESSAGE "Generujem tlačovú zostavu" ;
FORMSIZE XBPPRN_FORM_A4 ;
VIEWPORT 150,150,4750,6500 ; // toto je zhruba ok
MARGIN {-2,1} // prvé číslo horný okraj, druhé ľavý
* print file to PDF.
dcpstatus:=DC_PRINTFILE(suborptk2,.F.,"11.Courier New",aOptions)
where suborptk2 is converted file
RauknReport is "virtual" printer profile in PDF Creator.
This works fine, but You must have PDF Creator installed and also profile.
On Windows 10 can use Microsoft Print to PDF like this
DCPRINT ON NAME "Microsoft Print to PDF" TOFILE OUTFILE (cestatlac+'InfokatReport.Pdf') ;
TO oPrinter
Or can use Bullzip or PSCRIPT.DLL library, with DCPS, this is best solution.
I am also converting TXT files in CP 852 Latin2 (DOS) to PDF,
First I convert file from ANSI to OEM coding:
FUNCTION KONV_ANSI2OEM // konverzia súboru z ANSI do OEM
LOCAL outriadok:=""
LOCAL nSource18,nTarget18
PARAMETERS infile,outfile
IF ( nSource18 := FOpen( infile, FO_READ ) ) == -1
DC_Impl(cCakaj)
oznam2("Vstupný súbor sa nedá otvoriť:",infile)
return(.F.)
ENDIF
velkostsuboru:=filesize(infile)
cSourceString := Space( velkostsuboru )
nBytes := velkostsuboru
zostatok:=velkostsuboru
nSourcestring := FRead( nSource18, @cSourceString, velkostsuboru )
FClose( nSource18 )
IF ( nTarget18 := FCreate( outfile, FC_NORMAL ) ) == -1
DC_Impl(cCakaj)
oznam2("Výstupný súbor sa nedá otvoriť:",outfile)
return(.F.)
ENDIF
outriadok:=convtooemcp(cSourcestring) // samotná konverzia
FWrite( nTarget18,outriadok)
FClose( nTarget18 )
RETURN(0)
You can examine also convtoansicp() function, but for me works right convtooemcp
Then I write to PDF with PDF Creator
* set options for generate PDF report
DCPRINT OPTIONS TO aOptions NAME 'RauknReport' ;
BUSYMESSAGE "Generujem tlačovú zostavu" ;
FORMSIZE XBPPRN_FORM_A4 ;
VIEWPORT 150,150,4750,6500 ; // toto je zhruba ok
MARGIN {-2,1} // prvé číslo horný okraj, druhé ľavý
* print file to PDF.
dcpstatus:=DC_PRINTFILE(suborptk2,.F.,"11.Courier New",aOptions)
where suborptk2 is converted file
RauknReport is "virtual" printer profile in PDF Creator.
This works fine, but You must have PDF Creator installed and also profile.
On Windows 10 can use Microsoft Print to PDF like this
DCPRINT ON NAME "Microsoft Print to PDF" TOFILE OUTFILE (cestatlac+'InfokatReport.Pdf') ;
TO oPrinter
Or can use Bullzip or PSCRIPT.DLL library, with DCPS, this is best solution.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
Thank You Victorio!
Be sure to try and hopefully succeed
Be sure to try and hopefully succeed
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
Victorio!
And could you help me and make running the example program. This program when run, downloads a txt-file and converts it to a pdf-file. Examples of source and result files is in the first message. To be honest, I fiddled a bit, I read, I realized that there is still a lot of things plays role. In the end I have failed, what we need. Converts the file, but instead of pseudographics characters get just a dash, equal sign, etc.
And could you help me and make running the example program. This program when run, downloads a txt-file and converts it to a pdf-file. Examples of source and result files is in the first message. To be honest, I fiddled a bit, I read, I realized that there is still a lot of things plays role. In the end I have failed, what we need. Converts the file, but instead of pseudographics characters get just a dash, equal sign, etc.
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
Hi,
If you still have not solution, I can look for this.
I had also problem with convert semigraphics characters to PDF, especially when have two version of TXT files one in CP852 DOS page and other in Win1250 and need join it to one file and convert to PDF.
I must try your file what result have I. When I open your file in notepad, I do not see correct text because I have not Cyrilic on my PC installed.
If you still have not solution, I can look for this.
I had also problem with convert semigraphics characters to PDF, especially when have two version of TXT files one in CP852 DOS page and other in Win1250 and need join it to one file and convert to PDF.
I must try your file what result have I. When I open your file in notepad, I do not see correct text because I have not Cyrilic on my PC installed.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
I use AkelPad-4.9.8-bin-rus:
https://yadi.sk/d/ORdeuYWx3JCZgk
While I use it to convert txt to pdf. It is working correctly. Manually convert each file in turn (typing).
https://yadi.sk/d/ORdeuYWx3JCZgk
While I use it to convert txt to pdf. It is working correctly. Manually convert each file in turn (typing).
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
I'll try to do it in UNIX. I enjoyed it very much:
https://cygwin.com/install.html
https://cygwin.com/install.html
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?
Victorio!
And do not tell how to create a profile PDFCreater "RauknReport"
And do not tell how to create a profile PDFCreater "RauknReport"