Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

PB12.5 and Zebra Bar Code Printer Issues

5 posts in General Discussion Last posting was on 2013-03-14 13:27:37.0Z
ColinM Posted on 2013-03-13 15:18:04.0Z
Sender: 3695.51409715.1804289383@sybase.com
From: ColinM
Newsgroups: sybase.public.powerbuilder.general
Subject: PB12.5 and Zebra Bar Code Printer Issues
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <514098ac.3721.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 13 Mar 2013 07:18:04 -0800
X-Trace: forums-1-dub 1363187884 172.20.134.41 (13 Mar 2013 07:18:04 -0800)
X-Original-Trace: 13 Mar 2013 07:18:04 -0800, 172.20.134.41
Lines: 18
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249912
Article PK: 1308331

Hi All

We have recently migrated a PB 8.0 app to 12.5, and are
having issues printing barcode labels using the Zebra S4M
pinter, everything works great in PB 8, but we are having
real issues with PB 12.5. In order to solve the problem, I
have checked we are using the correct API calls ( Unicode )
and the values passed to them are the correct types, no of
bytes etc, but all we can get as an output is the barcode
itself, but no text, I have created a work around using
output to a text file then firing that off to the printer
and that comes out fine, is there an issues with the fonts
or something in PB 12.5 ?, Getting desperate on this one and
would appreciate any help / guidance

Thanks

-C


Chris Pollach Posted on 2013-03-13 15:49:19.0Z
From: Chris Pollach <cpollach@travel-net.com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130307 Thunderbird/17.0.4
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.general
Subject: Re: PB12.5 and Zebra Bar Code Printer Issues
References: <514098ac.3721.1681692777@sybase.com>
In-Reply-To: <514098ac.3721.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <51409fff$1@forums-1-dub>
Date: 13 Mar 2013 07:49:19 -0800
X-Trace: forums-1-dub 1363189759 172.20.134.152 (13 Mar 2013 07:49:19 -0800)
X-Original-Trace: 13 Mar 2013 07:49:19 -0800, vip152.sybase.com
Lines: 44
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249914
Article PK: 1308329

Hi Colin;

I suspect that it works in PB 8 because its ANSI based and not in PB
12.5.x because its Unicode based (since PB 10.0). You would have to make
sure that all string text is passed as ANSI to the printer if its driver
is still ANSI based. To do that, have a look at the Blob, String, etc
commands that have the *new* encoding argument. You may also need to
revisit the External Function declarations to make sure they have the
";ANSI" modifier.

--

Regards ... Chris
President: OSUG / STD Inc.
Vice President: ISUG-TECH
Blog: http://chrispollach.blogspot.com
SourceForge: http://sourceforge.net/projects/stdfndclass
PBDJ: http://chrispollach.sys-con.com
TKD: http://www.syeoh.com

On 3/13/2013 11:18 AM, ColinM wrote:
> Hi All
>
> We have recently migrated a PB 8.0 app to 12.5, and are
> having issues printing barcode labels using the Zebra S4M
> pinter, everything works great in PB 8, but we are having
> real issues with PB 12.5. In order to solve the problem, I
> have checked we are using the correct API calls ( Unicode )
> and the values passed to them are the correct types, no of
> bytes etc, but all we can get as an output is the barcode
> itself, but no text, I have created a work around using
> output to a text file then firing that off to the printer
> and that comes out fine, is there an issues with the fonts
> or something in PB 12.5 ?, Getting desperate on this one and
> would appreciate any help / guidance
>
> Thanks
>
> -C
>


ColinM Posted on 2013-03-13 22:09:28.0Z
Sender: 3695.51409715.1804289383@sybase.com
From: ColinM
Newsgroups: sybase.public.powerbuilder.general
Subject: Re: PB12.5 and Zebra Bar Code Printer Issues
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <5140f918.57ec.1681692777@sybase.com>
References: <51409fff$1@forums-1-dub>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 13 Mar 2013 14:09:28 -0800
X-Trace: forums-1-dub 1363212568 172.20.134.41 (13 Mar 2013 14:09:28 -0800)
X-Original-Trace: 13 Mar 2013 14:09:28 -0800, 172.20.134.41
Lines: 89
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249928
Article PK: 1308347

I have started to us the information kindly supplied and
here are the results


//lb_return = uo_winapi.OpenPrinterA (arg_printer,
lhPrinter, 0) // Failed to return a handle to the printer

lb_return = uo_winapi.OpenPrinterW (arg_printer, lhPrinter,
0) // Returned a handle

//lDoc = uo_winapi.StartDocPrinterA (lhPrinter, 1,
st_DocInfo)
// Does not return a print job number

lDoc = uo_winapi.StartDocPrinterW (lhPrinter, 1, st_DocInfo)
// Returned a print job number

The Barcode Printer is Unicode - Compliant, although I
suspect I would need to change a setting on it to work, so
am going to assume its ANSII by default

ldoc, which is the number of characters in the 'arg_data'
String
I suspect that the number of bytes is not being calculated
correctly

I increased the value by * 2, and I only managed to print
the barcode
lDoc = (Len (arg_data)*2)
// lDoc = Len((arg_data))

// if lb_return = true then lb_return =
uo_winapi.WritePrinter (lhPrinter, arg_data, lDoc,
lpcwritten)
if lb_return = true then lb_return = uo_winapi.WritePrinter
(lhPrinter, lsBarCodes[1], lDoc, lpcwritten) // Returns the
Number of characrters in the string * 2

I am curious why the Ansii API Calls fails and I am forced
to use the unicode api's

Thanks for the Guidance, I feel that I am starting to move
forward

> Hi Colin;
>
> I suspect that it works in PB 8 because its ANSI based
> and not in PB 12.5.x because its Unicode based (since PB
> 10.0). You would have to make sure that all string text
> is passed as ANSI to the printer if its driver is still
> ANSI based. To do that, have a look at the Blob, String,
> etc commands that have the *new* encoding argument. You
> may also need to revisit the External Function
> declarations to make sure they have the ";ANSI" modifier.
>
> --
>
> Regards ... Chris
> President: OSUG / STD Inc.
> Vice President: ISUG-TECH
> Blog: http://chrispollach.blogspot.com
> SourceForge: http://sourceforge.net/projects/stdfndclass
> PBDJ: http://chrispollach.sys-con.com
> TKD: http://www.syeoh.com
>
>
>
> On 3/13/2013 11:18 AM, ColinM wrote:
> > Hi All
> >
> > We have recently migrated a PB 8.0 app to 12.5, and are
> > having issues printing barcode labels using the Zebra
> > S4M pinter, everything works great in PB 8, but we are
> > having real issues with PB 12.5. In order to solve the
> > problem, I have checked we are using the correct API
> > calls ( Unicode ) and the values passed to them are the
> > correct types, no of bytes etc, but all we can get as an
> > output is the barcode itself, but no text, I have
> > created a work around using output to a text file then
> > firing that off to the printer and that comes out fine,
> > is there an issues with the fonts or something in PB
> > 12.5 ?, Getting desperate on this one and would
> appreciate any help / guidance >
> > Thanks
> >
> > -C
> >
>


Scott Morris Posted on 2013-03-14 13:27:37.0Z
Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes
Newsgroups: sybase.public.powerbuilder.general
Subject: Re: PB12.5 and Zebra Bar Code Printer Issues
References: <51409fff$1@forums-1-dub> <5140f918.57ec.1681692777@sybase.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: "Scott Morris" <bogus@abc.def>
Message-ID: <op.wtxucbq1q59cbq@scott-win7.divinv.net>
User-Agent: Opera Mail/11.51 (Win32)
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 14 Mar 2013 05:27:37 -0800
X-Trace: forums-1-dub 1363267657 172.20.134.152 (14 Mar 2013 05:27:37 -0800)
X-Original-Trace: 14 Mar 2013 05:27:37 -0800, vip152.sybase.com
Lines: 97
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249936
Article PK: 1308361


On Wed, 13 Mar 2013 18:09:28 -0400, <ColinM> wrote:

> I have started to us the information kindly supplied and
> here are the results
>
>
> //lb_return = uo_winapi.OpenPrinterA (arg_printer,
> lhPrinter, 0) // Failed to return a handle to the printer
>
> lb_return = uo_winapi.OpenPrinterW (arg_printer, lhPrinter,
> 0) // Returned a handle
>
> //lDoc = uo_winapi.StartDocPrinterA (lhPrinter, 1,
> st_DocInfo)
> // Does not return a print job number
>
> lDoc = uo_winapi.StartDocPrinterW (lhPrinter, 1, st_DocInfo)
> // Returned a print job number
>
> The Barcode Printer is Unicode - Compliant, although I
> suspect I would need to change a setting on it to work, so
> am going to assume its ANSII by default
>
> ldoc, which is the number of characters in the 'arg_data'
> String
> I suspect that the number of bytes is not being calculated
> correctly
>
> I increased the value by * 2, and I only managed to print
> the barcode
> lDoc = (Len (arg_data)*2)
> // lDoc = Len((arg_data))
>
> // if lb_return = true then lb_return =
> uo_winapi.WritePrinter (lhPrinter, arg_data, lDoc,
> lpcwritten)
> if lb_return = true then lb_return = uo_winapi.WritePrinter
> (lhPrinter, lsBarCodes[1], lDoc, lpcwritten) // Returns the
> Number of characrters in the string * 2
>
> I am curious why the Ansii API Calls fails and I am forced
> to use the unicode api's
>
> Thanks for the Guidance, I feel that I am starting to move
> forward

First, I'll point out that you could reduce the amount of work a bit by
taking the approach used by PFC in the file and platform services. You
declare the external function in an NVO - unicode or ansi. You then
create a function in the NVO to use this external function. This allows
you to change the external declaration without affecting your code. This
also allows you to provide overloaded functions in the NVO and implement
different ways of using that external function - optional arguments,
default values, etc.

Next - if you use any API function then you ABSOLUTELY need to use the
error checking logic that is appropriate/defined by the API
documentation. If you do not, then you are flying blind and any issues
that do come up you will not be able to solve. This can be compounded in
application logic if it does not do an adequate job of error checking -
something that seems to be rather common unfortunately (not that this
applies to you - just an observation). I assume that the standard
getlasterror (and message) logic should be used.

Next - you posted some sample code. It probably makes sense to you as you
have access to all of it and have probably been studying it a lot
recently. It isn't very meaningful to an outsider. I can point out one
problem with the converted ANSI code. StartDocPrinter takes 3 arguments -
the last of which is a pointer to a structure and the structure is
composed of string pointers. If you use the ANSI version, the structure
should contain pointers to ANSI strings. Otherwise, the structure should
contain pointers to UNICODE strings. So how does one create a structure
of ANSI string pointers? Not so easy to do in PB12.

I'm guessing that you have a similar (but opposite) issue with the
WritePrinter function. Note how there is only a single API function - no
ANSI and UNICODE versions. The second argument is a buffer - simply
binary data (bytes). Due to the way it is defined, there is no automatic
conversion from unicode to ansi provided by PB for strings. It is all up
to you to program it correctly. Notice also the definition of the 3rd and
4th arguments - these are number of BYTES, not characters. If the
definition of lsBarCodes is a string array, then you are attempting to
write a unicode string - the size in bytes is 2 * number of characters
(and I have no idea whether the terminating NULL character should be
included in that count as well). If your code was working in PB8, then my
guess is that you need to send ANSI strings. This is where my knowledge
is limited, but I believe that you will need to use blobs (and blob
functions) to convert your string from unicode to ansi in order to pass it
to this function as such.

Some last comments. A dword in PB is a ulong. If you use the wrong
datatype, you may encounter what seem to be random problems. PB
programmers tend to check for errors using something like "if return value
> 0" - an unsigned value is either zero or not zero and this logic can
"fail" incorrectly. In addition, a boolean value can be evaluated
successfully all by itself - you do not need to compare it to "true" or
"false". In other words: "if lb_return then " or "if not lb_return then".


Scott Morris Posted on 2013-03-13 15:48:33.0Z
Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes
Newsgroups: sybase.public.powerbuilder.general
Subject: Re: PB12.5 and Zebra Bar Code Printer Issues
References: <514098ac.3721.1681692777@sybase.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: "Scott Morris" <bogus@abc.def>
Message-ID: <op.wtv567tuq59cbq@scott-win7.divinv.net>
User-Agent: Opera Mail/11.51 (Win32)
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 13 Mar 2013 07:48:33 -0800
X-Trace: forums-1-dub 1363189713 172.20.134.152 (13 Mar 2013 07:48:33 -0800)
X-Original-Trace: 13 Mar 2013 07:48:33 -0800, vip152.sybase.com
Lines: 31
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249913
Article PK: 1308330


On Wed, 13 Mar 2013 11:18:04 -0400, <ColinM> wrote:

> Hi All
>
> We have recently migrated a PB 8.0 app to 12.5, and are
> having issues printing barcode labels using the Zebra S4M
> pinter, everything works great in PB 8, but we are having
> real issues with PB 12.5. In order to solve the problem, I
> have checked we are using the correct API calls ( Unicode )
> and the values passed to them are the correct types, no of
> bytes etc, but all we can get as an output is the barcode
> itself, but no text, I have created a work around using
> output to a text file then firing that off to the printer
> and that comes out fine, is there an issues with the fonts
> or something in PB 12.5 ?, Getting desperate on this one and
> would appreciate any help / guidance
>
> Thanks
>
> -C

Does your workaround involve creating an ANSI file? If so, I suspect the
issue is that your printer is expecting to see ANSI characters and not
Unicode characters. This may be a case where you changed the API
functions in error and that you actually need to use the ANSI versions.
One additional issue is that you may have (perhaps accidentally) confused
number of bytes and number of characters. In PB versions prior to 10,
these were the same numbers; so an assumption or confusion between the 2
values would not be diagnosable. In PB10+, this is no longer true (making
some assumptions about how one might write code to make these
determinations, of course).