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

Raster Image Height & Width

Raster Image Height & Width

Raster Image Height & Width

Delphi 2005: I have a PNG image which I convert to PCL.

If I use the raster image as is, with just the raster start & end commands the image prints too large to fit in the page, so I set the DPI Graphics resolution to 600 this works perfectly but since the image is a barcode it requires it to be in a desired height & width which I am not able to set.

I tired using all the below commands but to no avail.

Ec *r#T - raster height # pixels
Ec *r#S - raster width # pixels
Ec *t#V - scaled raster height #
Ec *t#H - scaled raster width #

Please Help

RE: Raster Image Height & Width

Are you being supplied with a PCL image of the barcode or an image file?

What barcode symbology is in use?

Jim Asman

RE: Raster Image Height & Width

I'm sorry, I see that you have a PNG. You really don't want to use those PCL raster commands. First, is there a reason why you are not using an appropriate barcode soft font and printing an "origina" as it were?

Otherwise, do all the sizing that is necessary when you convert to PCL at a given resolution.

If it is a simple 1D barcode such as 3of9 or Code128 then you can probably scale it as needed. Simply scale it to the necessary width and then shrink or grow the depth to suit.

If it is a 2D barcode, then you scaling will have to be linear and the same scale in both width and height.

Jim Asman

RE: Raster Image Height & Width

It's PNG image file, I do the conversion from PNG -- BMP -- PCL.
It's a UPS shipping barcode image, has Ship To & From address with tracking number and a standard 1D barcode in it.

RE: Raster Image Height & Width

Are you trying to recreate the entire PNG or are you just cropping out the barcode? Presumably, the PNG contains the original resolution, so it should be trivial reproduce it.

Go to my website and download a demo of my MKPCL program and see the tools that should suit your purposes, but in the meantime,
if you have the ability to provide a link to a copy of the PNG, do so; otherwise, email a copy to me at 'jlasman at telus.net'

Edit my email address as appropriate. The forum here discourages the posting of complete email addresses so as to discourage would be spammers from collecting addresses from our postings.

Do explain exactly how you want the final image to appear.

Jim Asman

RE: Raster Image Height & Width

Thanks, I tired to shrink the image before converting to PCL and it looks like it is working.
The image is generated by UPS software and using a third party vendor we get the image in png format. I will send you the png image, and the specification.

RE: Raster Image Height & Width

What is the target printer model?

Smaller, cheaper, models do not support PCL arbitrary scaling via the Raster Destination Width/Height sequences (<Esc>*t#H and <Esc>*t#V).

e.g. LaserJet Pro 400 Colour MFP M475dn supports the sequences, but LaserJet 1320n does not.

RE: Raster Image Height & Width

Can we assume then that the PNGs received are all the same size imagewise? If so, then you would only have to work out the percentage reduction/enlargement required for your purposes and that should be all you need as long as your software that converts to BMP allows for easy scaling.

I am curious though as to why there is a problem. Are you using the PNG for a purpose that wasn't intended when it was created?

Jim Asman

RE: Raster Image Height & Width

The one that I am using is a HP laserJet cm4730fm mfp.

We interact with the third party web service which gets us the PNG, I believe PNG is used because of it's acceptable size than any other format. The other options that I can specify is Zebra or Eltron but have no clue if they can be converted to PCL

RE: Raster Image Height & Width

Zebra and Eltron are both label printers that typically print labels that are on a long roll, where the PCL laserjets use a single sheet at a time.

Are you intending to print single adhesive labels or perhaps the image printed floating in the middle of a 8 1/2 x 11 sheet?

Jim Asman

RE: Raster Image Height & Width

Nope not on adhesive these would be printed on letter paper and put in a standard UPS envelope with a window.

I had to add these additional instructions to get the image on desired location,
Esc &l1O - Landscape
Esc &a8R - Row 8
Esc &a55C - Column 55

RE: Raster Image Height & Width

FYI everyone, the original PNG image is 1616x2395 pixels @ 403 dpi which translates to the size of a typical 4x6 in. shipping label used for things like this. As the LJ cannot print at 400 doi, then the image needs to be scaled appropriately and then printed at a standard LJ resolution. Scale to 150% and print at 600 dpi will work. Scale down to 50% and print at 200 dpi would also work, The 600 dpi scenario would be preferable as the barcode will ultimately be scanned.

You should really have a complete page format rather than just the landscape command so you don't rely on any printer default settings that could be changed by someone with access to the printer; eg,

Esc &l2a1o6d3e45F

Also you can use user units(300 dpi, 600 dpi) for placing the scan, allowing far greater accuracy in the placement. Further, if you wanted to get ride of the landscape, you could rotate the image 90 degrees somewhere in the conversion, PNG > BMP > PCL

Jim Asman

RE: Raster Image Height & Width

Just to add to Jim's comments regarding full initialisation, and not relying on user-environment (power-on) printer default settings:

With the suggested initialisation sequences:

CODE -->

<Esc>&l2a         Page Size: Letter
       1o         Orientation: Landscape
       6d         Line Spacing (6 lines-per-inch)
       3e         Top Margin (3 lines)
       45F        Text Length (45 lines) 

the sequence:


<Esc>&a8R         Cursor Position Vertical   (row 8) 

will set the cursor vertical position to 8/6 (= 1.33) inch from the top margin, but the sequence:


<Esc>&a55C        Cursor Position Horizontal (column 55) 

will set the cursor horizontal position to 55 columns, of whatever is the current column width, from the left margin; the column width may be set implicitly via the current font selection (whatever that has been set, or defaulted, to), or explicitly via the <Esc>&k#H (Horizontal Motion Index (#/120 inches)) sequence.

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