Clipboard Image Barcode Hiding Follow

0
Avatar
Legacy Poster

I have a label that contains a list of barcodes. If their related SubString value is "0" I hide the barcode via a VB Script attached to the OnNewRecord Event for example:
If Format.NamedSubStrings("Qty2").Value = "0" Then Objects("Bar Code 2").PrintVisibility = False End If

That all works fine when I print the barcode in C#. For example:
Result result = document.Print(string.Format("", txtCaseLabelRunID.Text), out messages);

However, when I render the same document to the Clipboard the same barcode is still visible. For example:
document.ExportImageToClipboard(Seagull.BarTender.Print.ColorDepth.Mono, new Resolution(pictureBox.Width, pictureBox.Height));

I've tried some other approaches, setting the X location, etc. without success.

Is there some way to control visability of label objects when rendering them to the clipboard?

Stephen

6 comments

0
Avatar
Legacy Poster
Comment actions Permalink

Hmm. I wonder if you could script a white box to expand in size based on your VB script, which would then cover the barcode you don't need.
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

Hi Stephen,
VBScript OnNewRecord event only runs while printing, so not executed when exporting image.
If you give empty value ("") to barcode, the barcode won't be shown.

When you want to hide a barcode when datasource is "0", in the Barcode datasource's more options > VB Script > OnProcessData event,
[code]
If Value = "0" Then Value = ""
[/code]

(substring value cannot be updated from OnNewRecord, OnSerialize and OnIdenticalCopies events in Label Format option script - but, object visibility cannot be set from substring based VB Script like OnProcessData event)
0
Avatar
Legacy Poster
Comment actions Permalink

I started there. The barcode is a PTI composite barcode and so its value is never really "0". The "0" Quantity value is a piece of the composite source. From the a member of a group of composite substrings, is there a way to address the related object. All of the object properties seem to be read only.
0
Avatar
Legacy Poster
Comment actions Permalink

For anyone that is having a similar issue, I've resolved my issue thanks to a conversation with some excellent support folks. I changed from generating the image on the clipboard (document.ExportImageToClipboard) , to generating it to a temp file (document.ExportPrintPreviewToFile). The file generation method runs my VB scripts, the clipboard method doesn't. A couple of cautions, the document.ExportPrintPreviewToFile method takes a filename as a parameter and then generates a filename with a "1" appended to it before the file extension. This is not easy to see if you're generating your filenames via GUIDs. I'm using a temp directory for those files, which need to be cleaned up somehow via some code or the OS/Utilities.
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

Thanks for posting the good solution!
You right, document.ExportPrintPreviewToFile would run VB scripts just like BarTender's print preview does.
One note - [u]ExportPrintPreviewToFile is supported by Enterprise Automation edition only[/u], so anyone on BarTender trial, that is one indicator to pick Enterprise Automation edition over Automation edition.
0
Avatar
Legacy Poster
Comment actions Permalink

Okay, I'm stumped. Where in the BarTender 10.0+ UI do find events and their related scripts? I have some, but I can't find them any more :-).

Please sign in to leave a comment.