Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Raster Image Height & Width

Status
Not open for further replies.

hdesai24

Programmer
Jan 19, 2012
6
0
0
US
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
 
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
 
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.
 
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
 
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.
 
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.
 
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
 
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
 
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
 
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
 
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
 
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:

Code:
<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:

Code:
<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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top