Skip to main content

Search

Search

Is it possible to add printer commands to a field?

Comments

5 comments

  • Avatar
    Shotaro Ito

    What printer do you use?
    When you use printer driver by Seagull, and the printer supports serialization on Code128 barcode,
    You can create a print job to specify multiple serialized copies to save print job size.

    There's some conditions to make device serialization.

    1. In BarTender print dialog, Performance tab, enable [Allow serialization]
    2. Variable text (Serial number) must be Device font (ex: Zebra Triumvirate, Datamax Font 1 etc.)
    3. No VB script is used in serialized data source
    4. Media handling (ex: Auto cutter per database record etc) not set (Use driver's settings)
    5. No other template inserted in Page setup > Templates

    There could be more reason  - please check white paper below.
    https://www.seagullscientific.com/media/101561/optimizing-print-output-201511.pdf

    Another option is Print Code Modifier.
    You can modify print code generated by BarTender + Driver, before sent to printer.
    From file > BarTender document options > General tab. VScript Sample is below.
    http://help.seagullscientific.com/2016/en/Index.htm#vbs_PCM.htm
    Personally I don't recommend this approach for serialization though.

    In both cases, when you enable [Print To file] tick on Print dialog, you can save print code to file instead of sending printer.
    (Print to file option is not available in Trial edition.)

    0
  • Avatar
    Jim Mason

    Thank you Shotaro Ito, the print code modifier example is exactly what I need. I've tried the other methods which generally work until you link a database to the label, when they do not. Tech support are working on this at the moment.

    0
  • Avatar
    Jim Mason

    Update to this, as I've got font information which is binary I need to use the ReadBytes and Writebytes method for matching strings. I've never used these before and I can't get my head around the use of them. I can read a byte and write it back, that all works fine, but how do I compare a byte? I've tried everything I can think of but always get a type mismatch error. Any help gratefully received.

     

    Option Explicit

    Dim byteBuf(1)
    Dim first_byte,second_byte,third_byte,fourth_byte,dummy
    Dim value_write


    while not PCM.FileAtEOF
    dummy=PCM.ReadBytes(byteBuf, 1)
    first_byte=byteBuf
    value_write=PCM.WriteBytes(byteBuf, 1)
    dummy=PCM.ReadBytes(byteBuf, 1)
    second_byte=byteBuf
    value_write=PCM.WriteBytes(byteBuf, 1)
    dummy=PCM.ReadBytes(byteBuf, 1)
    third_byte=byteBuf
    value_write=PCM.WriteBytes(byteBuf, 1)
    dummy=PCM.ReadBytes(byteBuf, 1)
    fourth_byte=byteBuf
    value_write=PCM.WriteBytes(byteBuf, 1)

    wend


    'I need to compare first_byte with '3', Ascii 51


    if first_byte=???? then '(whatever I put here,51, chr(51), asc("1") i get type mismatch)

    'actions here on a match

    end if

    0
  • Avatar
    Shotaro Ito

    Hmm. Handling binary in PCM is actually difficult.
    Simple binary code sample is below but that doesn't explain how to compare binary sequence.

    Option Explicit
    
    Dim byteBuf()
    Dim codeSize, numRead, numWritten
    
    codeSize = PCM.InputFileSize
    numRead    = 0
    numWritten = 0
    
    ReDim byteBuf(codeSize)
    numRead = PCM.ReadBytes(byteBuf, codeSize)
    numWritten = PCM.WriteBytes(byteBuf, numRead)

    Store codes to array of binary (which actually is 8bit int) so you can simply compare such as

    If byteBuf(x) = 51

    Or try below:

    - Find out the reason why BarTender's serialize optimization not working. Note that GS1-128 serialization doesn't work on BT10.1 (which fixed in BT2016)

    - Some driver allows to use text format for TrueType font / Image. Check Print dialog > Document Properties > Options tab etc.
    Once you can rule out binary from print code, handling code is much easier.

    0
  • Avatar
    Jim Mason

    Thanks Shotaro Ito, that did it. I needed to use first_byte=byteBuf(0), I didn't realise it is an array of one byte!

    0

Please sign in to leave a comment.