Frequently Asked Questions

Build 1501 on 14/Nov/2017  This topic last edited on: 24/Oct/2016, at 14:35

Q. “In GN4 I have only one title, but on <day of the week> I publish a separate publication, that is a weekly, while everything else is a daily. How can I generate its barcode?”

A. Two solutions are possible. The first one would be to have a separate “Zone” for the publication, which is associated to the weekly edition, which has the “PriceChange”, “Frequency” and “ISSN” values, different from the values in the other zone. The other solution, if the Zone cannot be used, would be to write a more complex script that changes the parameters of the Barcode object at run-time. A sample script follows:

Dim oBC As Barcode = New Barcode("40mm", "30mm")

if oBC.Generate() Then

  ‘ Check if the edition is on a Sunday:

  Dim oEdition = FredApp.ActivePageDispatcher.GetEditionObj

  If oEdition.dateAttr.ToLocalTime().DayOfWeek() = DayOfWeek.Thursday then

   oBC.Frequency = 2

   oBC.PriceChange = "03"

  End if

  oBC.SrvSaveFile("C:\BACK4\IN\Barcodes")

  oBC.Place("200mm", "350mm", False)

End If

 

Q. “I want the barcode on some of my editions to be rotated 90 degrees. How can I do it?”

A. Similarly, you should write a script that behaves differently depending on the current zone. An example follows:

Dim oBC As Barcode = New Barcode("40mm", "30mm")

if oBC.Generate() Then

  oBC.SrvSaveFile("C:\BACK4\IN\Barcodes")

  Dim bRotate as Boolean = True

  Select Case FredApp.ActivePageDispatcher.GetPageZone()

     Case 24,27,25,26:

 bRotate = false

     Case 28,32,30,31,33,29:

          bRotate = true

  End Select

  oBC.Rotation = bRotate

  oBC.Place("200mm", "350mm", True)

end if

 

Q. “This is neat, but you rotate the barcode counter-clockwise. I want the barcode rotate 90 degrees clockwise. Is this possible?”

A. Keeping in mind that a barcode is readable by the scanner in any position it may be presented to it and that this question is therefore meaningless. To do so would require a change in CustomBarcode.vb replacing the line:

If Page.ObjSetAngle(90, 1) <> 0 Then

To:

If Page.ObjSetAngle(-90, 1) <> 0 Then

This change will apply to every single barcode’s rotation (i.e. you won’t be able to have the barcode rotated left on some editions and right on others).

Q. “How can I add text (say, the price) over the barcode?”

A. This is done by adding one or two parameters to the call to the Place method, as explained in its documentation:

Public Function Place(BCX As String, 

       BCY As String, 

       Optional bDoTitle As Boolean = False, 

        Optional sTitle As String = Nothing) As Boolean

     Member of TeraDP.GN4.AddIns.Miles33Barcode

Summary:

Places the image for the Barcode object on page, at the requested position and with the relevant text around it. If sTitle is not Nothing, creates a text box over the barcode with that string. If the bDoTitle is true and sTitle is Nothing, will print the ISSN of the publication.

Parameters:

BCX: X position of the barcode image

BCY: Y position of the barcode image

bDoTitle: True: generate text box above the barcode

sTitle: GNML text to print over the barcode image. If missing and bDoTitle is true, will print only the ISSN

 

Q. “What will happen if I don’t install the OCR-A font?”

A. The text under the barcode will print out in Arial. While this is not a problem, it is not strictly correct and the barcode will not be following the EAN standard, but we doubt it will ever become an issue.

Q. “Do I have to install the OCR-A font with a specific Tera’s Id?”

A. Not at all: the barcode software will embed the TTF in the image by reading the font installed on the server. It is not necessary to install OCR-A in GN4 unless you want to use it for other scopes.

Q. “What is the format and resolution of the image?”

A. The image will be saved as a bitmap at 300dpi. This is a constant in CustomBarcode.vb and can be changed by editing this line:

Private mResolution As Short = 300

The file is generally in JPG format, but it can be saved as an uncompressed TIFF by setting an optional parameter at the call:

oBC.SrvSaveFile("c:\pics\in\barcodes", True)

Q. “What is the path for the SrvSaveFile method?”

A. The method SrvSaveFile calls the system workflow which saves the barcode on disk, in a folder monitored by a Back4 queue which processes images and creates <img> objects in a folder. This Back4 queue must be created and configured using the standard template ImportImg. The path is local to the server and must be accessible to the Web server. The user doesn’t have to be able to see this folder. We have decided to allow the developer to indicate the folder in the script, rather than having it configured somewhere, to increase the flexibility of the system.