Clipboard Image Barcode Hiding
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
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
0
-
Legacy Poster
★ BarTender Hero ★
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 -
Shotaro Ito
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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 -
Shotaro Ito
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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 :-). 0
請登入寫評論。
評論
6 條評論