January 20, 2011 at 9:46 am
I am writing a stored procedure that has PCL embedded to print out a report that includes bar codes.
This sproc will get called from a web application to print the report.
The problem I am having is with the bar code not printing correctly or not at all.
I have searched high and low on the internet for some help on how to code this, but only found bits and pieces to help me out.
So, I am hoping maybe someone has used this method before.
This is what the pcl portion of the code looks like:
SELECT @v_vchPCLBackGround =
CHAR(27) + '%-12345X' +
--'@PJL COMMENT HP LaserJet 4@PJL SET PAGEPROTECT=OFF@PJL SET PAGEPROTECT=AUTO@PJL SET RET=MEDIUM@PJL SET RESOLUTION=600@PJL ENTER LANGUAGE=PCL' +
CHAR(27) + 'E' +/* Printer Reset Command */
CHAR(27) + '*t600R' +/* Raster Graphics Resolution */
CHAR(27) + '&u600D' +/* Unit of Measure (units per inch) */
--CHAR(27) + '*r3F' +/* Raster Graphics Presentation Mode */
CHAR(27) + '&loO' +/* Orientation */
CHAR(27) + '&l0H' +/* Paper Source */
CHAR(27) + '&l2a8c1E' +/* Page Size , Vertical Motion Index , Top Margin*/
CHAR(27) + '*p0x0Y' +/* Set cursor position to 0,0 */
--CHAR(27) + '*c0t5760x7680Y' + /* Picture Frame Anchor Point?, Picture Frame Horizontal Size, Picture Frame Vertical Size */
CHAR(27) + '&l1X' +/* Number of Copies */
CHAR(27) + '*b0M' +/* Compression Method */
--CHAR(27) + '(19U' +/* Symbol Set ((symbol set id)u (windows 3.1 latin 1)*/
--CHAR(27) + '(s16901t6b0s14v1P' +/* Typeface Family - (s(typeface family value)t, 0b = stroke weight, 0s = style, 32.5v = height, 1p = spacing */
CHAR(27) + '*p0Y' +/* Vertical Cursor Positioning - *p(pclunits)y */
CHAR(27) + '*p0X' +
CHAR(27) + '&d@' +/* Disable Underline */
CHAR(27) + '*v2o0T' /* Transparency Mode & Pattern */
------/* ----------------Header Form text---------------------- */
SELECT @v_vchPCLBackGround = @v_vchPCLBackGround +
CHAR(27) + '(8U' + CHAR(27) + '(s16901t1p25v0s3b' +
CHAR(27) + '*p166Y' + CHAR(27) + '*p10X' + 'TRAILER VERIFICATION REPORT' +
CHAR(27) + '(8U' + CHAR(27) + '(s16901t1p18v0s1b' +
CHAR(27) + '*p350Y' + CHAR(27) + '*p450X' + 'Trailer Number' +
CHAR(27) + '(8U' + CHAR(27) + '(s16901t1p18v0s0b' +
CHAR(27) + '*p500Y' + CHAR(27) + '*p500X' + @v_vchEquipmentId +
--at this point I enter the barcode information
I have tried these lines and they don't really work at all:
CHAR(27) + '(0Y' + CHAR(27) + '(s0p4.69h12.0v0b0T *123*' + CHAR(27) + '(3@'
CHAR(27) + '(0Y' + CHAR(27) + '(s1p12v0s0b32772T*ABCDE123*' + '(3@'
CHAR(27) + '(0Y' + CHAR(27) + '(s0p8.1h12v0s0boT*12345* + '(3@'
I also found this line to use and it almost works:
CHAR(27) + '(25531X*' + @v_vchEquipmentId + '*' + CHAR(27)
The problem with this one is that it doesn't print the number 7,8,9 or the uppercase letters I-Z;
but, it will print lowercase letters. This is not what a 3 of 9 barcode should do.
CHAR(27) is the escape character
Any help on what I am doing wrong or how to get this to work would be greatly appreciated.
January 20, 2011 at 3:15 pm
I think you're not going to get much help here, as this is not a TSQL question. For what it's worth, your TSQL looks fine. I do have to wonder whether the database is the right place to be crafting PCL, but... I guess that's for you to decide.
Maybe try the PCL forum at tek-tips?
-a.
Dan Guzman - Not the MVP (7/22/2010)
All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'
March 2, 2011 at 5:47 am
Hello, topic owner. Did you find the correct PCL syntax for generating barcodes? I am also facing exactly the same problem as you..
Please reply to this thread if you have fixed this problem. Thanks
March 2, 2011 at 6:22 am
No, I have not found a solution to this problem. I did find out that the reason I was only getting a partial bar code to print is that this points to a sample bar code. I am awaiting a reply from the printer company to see why I am still having problems printing out a barcode that the printer says is installed.
March 2, 2011 at 7:01 am
CHAR(27) + '(25531X*' + @v_vchEquipmentId + '*' + CHAR(27)
I am assuming you have installed a barcodes soft font with Id (25531) on your printer or is it a default? Am I making a right assumption? Coz when i tried with your above line im just getting "@v_vchEquipmentId" as a output. Please clarify this.
I have read somewhere regarding this approach, but I have not tried this myself.
March 2, 2011 at 7:39 am
I am not completely sure if it was installed as a soft font or not. I am completely wet behind the ears on this printer stuff. We did lose power a couple weeks ago and now I don't get anything to print. So, I am assuming that it was installed and then it was lost after the power went out.
When I print now, I get the same as you, just the variable for equipment id prints out, not the barcode. At least before, I got a partial barcode.
March 3, 2011 at 4:14 am
I tried using the soft font method as mentioned earlier, and now I am able to print the barcode, but as you have mentioned 7,8,9 are not supported even 'N' and some other characters are also not supported. I understand why this is happening. Since the soft font i have installed is a demo font it will not have all the characters and number supported. I will be investing some more time in this approach. Hopefully i get a full version font to print the barcode. ..:-)
March 3, 2011 at 6:17 am
If you're approach at installing a soft font works, please let me know! I had approached this idea earlier in this project, but because the printer said there were fonts installed, they wanted me to try those first. I am still waiting to hear from Lexmark support about this. At least I know that my code partially works
March 3, 2011 at 8:04 am
I believe moving ahead with this approach is pretty useless, as we cannot ask user of our web application to install the Soft font on his local system before printing barcode... ... We can easily get the licensed soft font and do the printing with it..This approach is best only if you are printing barcode from fewer machines.
I am not finding any other alternative to move ahead for barcode printing!!
February 29, 2012 at 3:53 am
Last reply marked as spam.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy