×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Creating Raster Data

Creating Raster Data

Creating Raster Data

(OP)
All,

  After reading through HP's PCL manual, I have been able to manipulate fonts, rectangular fills areas ect. with a high degree of sucesss. However, I am a bit stumped by the Raster Data.

 Is it possible to extract the raster data commands from an existing image (bmp,tif,jpg,ect)? I have tried to extract the commands by priting to a file and using pclcodes to decrypt the .prn file but the raster data is very garbled..

Thanks!!

RE: Creating Raster Data

You can have some success in retrieving the raster data from an image file by printing it through a PCL driver to a file.

Browse back a ways in the threads in this forum for one titled "Embedding graphics in a PCL document". That was a lengthy discussion.

Jim Asman

RE: Creating Raster Data

(OP)
Thanks! That was quite a discussion! But I still have some questions.

Is there any way to get the raster data PCL commands in a text format? I would like to do this so that I can send images down to the printer each time.

I know that you can upload (lpr or copy ) a .prn of pcl file to the printer with a logo, but that solution doesn't work very well b/c printers are turned off frequently, & users move around quite a bit..

The application allows for multiple print profiles that a user can select, and I have figured out how to inject pcl codes into these models. This has worked very well, but I can't figure out how to create the raster data for an image file.



RE: Creating Raster Data

Raster data IS 8 bit. I know of no provision in PCL to have an intermediate text format like uuencode that the printer would compress back to 8 bit.

I don't really understand what "text Only" does for you. Simply embed the PCL raster file into your document. It does NOT have to be sent to the printer BEFORE the document. That method is usually brought up where the application has no means of sending the raster data at runtime.

Jim Asman

RE: Creating Raster Data

(OP)
Ah.. Well, perhaps I haven't provided you with enough information.

 I am using the PCL commands in a custom app that runs on an Oracle database. All of the PCL commands I have entered have been plain text. That's where I am at a loss as to how to utilize the raster data in this environment.

All of the PCL commands have been stored in a LONG RAW column in the database. I guess I could look into some how uploading the contents of the .prn file into this column. But I am not really sure of how to do this in Oracle..

Thanks for all of your help.

RE: Creating Raster Data

Does Oracle not have a provision for a a file to be injected into the data steam when desired? It would seem to be an elementary function.


Jim Asman

RE: Creating Raster Data

(OP)
I don't think so.. I have been checking into that.
Do you know of any programs on the Windows platform that provide this functionality?

RE: Creating Raster Data

Here's what I do.

I create a text file with 1's and 0's making the "picture"
I want. 1's represent a dot, 0's represent no dot.

The "1/0" "image" is usally rather large in comparison to how it will print.

I then have a basic program I wrote to read the lines (padded to a multiple of 8),and then for each 8 characters
in the line I figure what the character value is and
print to another file the chr$().

I don't have the program on this computer but it's comething like the following:

open "rastpic.txt" for input as #1
open "raster.dat" for output as #2
print #2,chr$(27)+"*r1A";
while not eof(1)
line input #1,LL$
print #2,chr$(27)+"*b23W";
for k&=1 to 23

 for L&=1 to 8
    if mid$(LL$,(k&-1)*8+L&,1)="1" then char$=chr$(2^(L&-1)) else char$=chr$(0)
    x$=x$+char$
 next
 print #2,x$;
 X$=""
nrxt k&
wend
close #1
close #2

now this is from memory and without looking at the program
I have. It assumes a line length of 184 representing 23
characters. The characters may need to be done in reverse
order high to low instead of low to high the way I have it
above but that's no big deal.

In that case, it would be for L&=8 to 1 step -1
and chr$(2^(L&-1))

print #2,chr$(27)+"*rB";


RE: Creating Raster Data

(OP)
Clever!

Any chance that you could send me a copy of the program that you have written when you get on your other computer?? <mailto:cstuart@myspeedworks.com> ?
If so, that would be great!

I pasted the code your provided into vb, but I am getting some mixed results on the outcome..


Thanks!

RE: Creating Raster Data

well I would try running the program in qbasic or quick basic instead of VB.

uh, I'll look for the program that i wrote

RE: Creating Raster Data

here's the little basic program. Use qbasic or quickbasic or
Powerbasic for dos, etc to run it.

10  REM -- PUT LINE NUMBERS IN FOR THEOS
20  REM -- THIS IS AN EDIT FILE WITH 0 AND 1 TO MAKE UP AN IMAGE
30  REM -- CONVERT TO HP RASTER GRAPHICS
REM -- above test files
      'this is the text file edited with 1's and 0's
      'for purposes here, each line is assumed to be 184 charaters,72 lines
      'change the names of files as appropriate
80    OPEN "RAST2004.x30" FOR INPUT AS #1
90  REM -- for theos
100 REM OPEN #1:"RAST2004.X30" INPUT SEQUENTIAL
110 DIM rdata%(12)
120 REM -- THIS IS THE OUTPUT FILE FOR THE RASTER GRAPHICS
130 REM    'OPEN "RASTER.T10" FOR OUTPUT AS #2
140     OPEN "RASTER.T2004" FOR OUTPUT AS #2
150 REM -- FOR THEOS
160 REM OPEN #2:"RASTER.T2004",OUTPUT SEQUENTIAL
170 REM -- SETUP RASTER GRAPHICS AND START COMMAND
180 REM    'PRINT #2, CHR$(27); "&a2.5r255H";
190     PRINT #2, CHR$(27); "&a2.5r2960H";
200     PRINT #2, CHR$(27) + "*t100R";
210     PRINT #2, CHR$(27) + "*r1A";
220     WHILE NOT EOF(1)
230        LINE INPUT #1, MM$
           MM$ = MID$(MM$ + SPACE$(184), 1, 184)
240 REM -- FOR THEOS   
250    REM  LINPUT #1: MM$
260        FOR k% = 1 TO 184 STEP 8
270            a% = VAL(MID$(MM$, k%, 1)) * 128
280            a% = a% + VAL(MID$(MM$, k% + 1, 1)) * 64
290            a% = a% + VAL(MID$(MM$, k% + 2, 1)) * 32
300            a% = a% + VAL(MID$(MM$, k% + 3, 1)) * 16
310            a% = a% + VAL(MID$(MM$, k% + 4, 1)) * 8
320            a% = a% + VAL(MID$(MM$, k% + 5, 1)) * 4
330            a% = a% + VAL(MID$(MM$, k% + 6, 1)) * 2
340            a% = a% + VAL(MID$(MM$, k% + 7, 1)) * 1
350            v% = FIX(k% \ 8) + 1
360            rdata%(v%) = a%
370        NEXT k%
'-------------
'  23*8=184
'-------------
380        PRINT #2, CHR$(27); "*b23W";
           FOR L%=1 to 23
              PRINT #2,CHR$(rdata%(L%));
           NEXT L%
410   WEND
420   PRINT #2, CHR$(27); "*rB";
430 REM PRINT #2: CHR$(27); "*rB";
550 REM -- close files
560   CLOSE #1
570   CLOSE #2

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close