Hello,

I have searched this forum extensively for this issue and couldn't find it which leads me to believe it's either too difficult and can't be done, or too simple and I'm overlooking something (most likely the latter).

I am making simple location labels for our warehouse. This consists of a barcode and text underneath it. I decided not to use the Human Readable option so I could have better control over the text.

Because the length of a location can be dynamic, I set the text and font size/barcode spacing using PP Talk to prevent them from going off the page. Something like this:


Code:
&location := uppercase(trim(XmlGet('/location_labels[1]/location_label[1]/location[1]')))
define(&BarWidth,integer,12)

if(length(&location) >= 12)
        &BarWidth := 12
elseif(and(length(&location) >= 9, length(&location) < 12))
        &BarWidth := 18
elseif(length(&location) < 9)
        &BarWidth := 22
endif()

showbarcodecode39(&location, &BarWidth, False, False, FALSE)



The purpose here is to increase or decrease the barcode width based off of the number of characters. I initially tried to do a repeat loop and decrease the font size until the object was less than the page width, but had issues, so this was the next best solution.

Here's the issue: I would like for the barcode and location text to be centered on the label. I tried the translate procedure calculating the width of the object against the width of the page, but because the text and barcode are generated via PP Talk, the proper object width is not registering. It thinks the object is blank. I have experimented with the placement of the code in PP Before and PP After with no avail. I've also tried a tip I learned form another forum post where I recreate the same barcode object off the canvas just to set the width. This also did not work.

How can I get the proper width of a dynamic object to translate it to the center of the page?

Thanks for your help.


Edited by GHerman (04/20/21 01:46 PM)