Page 1 of 1

How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Sun Dec 17, 2017 8:46 am
by Eugene Lutsenko
How to convert DOS-TXT file OEM-866 (Rus) to doc in Alaska?

Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Wed Dec 20, 2017 9:11 am
by Eugene Lutsenko
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?

Posted: Wed Dec 20, 2017 11:25 am
by Victorio
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.

Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Thu Dec 21, 2017 3:35 am
by Eugene Lutsenko
Thank You Victorio!
Be sure to try and hopefully succeed

Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Fri Dec 22, 2017 7:39 pm
by Eugene Lutsenko
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.

Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Thu Dec 28, 2017 4:58 am
by Victorio
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.

Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Thu Dec 28, 2017 5:31 am
by Eugene Lutsenko
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).

Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Sat Dec 30, 2017 11:22 am
by Eugene Lutsenko
I'll try to do it in UNIX. I enjoyed it very much:
https://cygwin.com/install.html

Re: How to convert DOS-TXT file OEM-866 (Rus) in doc?

Posted: Mon Jan 15, 2018 2:14 am
by Eugene Lutsenko
Victorio!

And do not tell how to create a profile PDFCreater "RauknReport"