Home » VB.NetRSS

Reading *.prn file into c#

I try to read a prn file into my application, in order to make some changes and then produce output.

I get only wierd jibrish signs. Do I have to read this file with some special encoding?

 

6 Answers Found

 

Answer 1

Hi Spivakov83,

   Welcome to ASP.NET forums! I'm glad to see your active participation and discussion in MSDN forums. Based on your issue please refer to

   http://msdn.microsoft.com/en-us/library/cc488002.aspx  [Convert RTF to Plain Text (C# Programming Guide]

  Hope this will help you!  

   If you still have any doubt and concern about this issue, please let me know. If I misunderstood you, please kindly elaborate your question.

 

Answer 2

I tried to read  a prn  file and it is working fine.

What application  are you using to produces prn file?

If you are using StreamWriter then you can specify the Encoding used in contstructor second parameter.

What gibberish sysmbols are you exactly talking about. Generally prn files contains commnet starting with %% in top lines of prn fie.

 
 

Answer 4

Hi, the prn  file is produced by an old legacy system, which code I can't chage, hence can't change the encoding.

During my many attempts, I've created a prn file  from microsoft word and still no success in reading.

this is the example of the gibberish signs (don't mind the firs 5 rows):

"!R!SEM6;HPBG;EXIT;%-12345X@PJL COMMENT Version 3.6

@PJL SET ECOPRINT=OFF

@PJL SET RET=OFF

@PJL SET HOLD=OFF

@PJL SET USERNAME="1"

@PJL SET RESOLUTION=600

@PJL ENTER LANGUAGE = PCL

E*t600R&u600D*r0F&l0O&l0S!R!PSRC100;EXIT;!R!spsz6,0;stm0;exit;*p0x0Y*c0t5765x7680Y&l1X*b0M

*c16534D)s68W D   B ° Y U td \        ? t            Cache 16534     XX(16534X&d@*c34E(s160W     #  $ ” ?    €??????€??€?? ?~  ~  ~    ~  ~  ~  ~  ~  ~  ~  ~  ~  ~~  ~  ~   ? ??€??????€    ? *c35E(s156W     #   # œ   "

 

As far as I have studied the subject, I understood that these files conatin scripts that are  passed to a local printer and the tell it how to print the content. Even if the script would be translated into understandable English, I still would like to differ the content from the script...I think this subject is hopeless. Thanks.

 

Answer 5

Imagine a very simplified printing script language using plain english words.

Printing the text "A" could be written in a script like this:

"Draw a line from (0, 200) to (50, 0). Draw a line from (50, 0) to (100, 200). Draw a line from (25, 100) to (75, 100)."

What you're trying to achieve is taking such a script and translating it back to "A".

 

Answer 6

That is exactly what I need.

Any suggestions?

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter