An example of creating barcodes in a 1C:Enterprise 8.2/8.3 spreadsheet document in a managed application mode. Below are examples for EAN-13, GS1-128, QR code and other common barcode formats.

To work with the example, you will need to install the StrokeScribe software.

The example is intended only for the managed application mode and has been tested for compatibility with 1C 8.2/8.3 versions.

The example requires StrokeScribe 4.2 or later to be installed.

Preparing a layout for barcode output

1. Create a new report in the 1C:Enterprise 8.2 constructor and give it a name ReportBarcode(this name will be used in the module below).

2. For report ReportBarcode create a spreadsheet document layout named LayoutBarcode.

3. In the layout, create an area of ​​arbitrary size named Area Barcode.

4. Place an image in the area (menu Table->Images->Picture) with the dimensions of the future barcode. Specify a name in the image properties - DrawingBarcode.

As a result of all actions, a report layout similar to the one shown in the figure should be obtained:

Report module

&AtServer Function DocAtServer() TabDoc = New SpreadsheetDocument; Layout = Reports.ReportBarcode.GetLayout("LayoutBarcode"); Region = Layout.GetRegion("RegionBarcode"); //Pay attention to the coincidence of the names of the report, layout and area in the module and in the design barcode = GetCOMObject("","STROKESCRIBE.StrokeScribeClass.1"); //Did you forget to install StrokeScribe? Filename=GetTemporaryFileName("wmf"); //Temporary file in temporary directory with .wmf extension barcode.Alphabet=25;//QR CODE barcode.Text="123ABCD";//Data for barcode code=barcode.SavePicture(FileName, 7, //7=WMF 100 , //Barcode image width 100); //Height of the barcode If the code<>0 Then //Checking the barcode generation result Report(string(code) + " - " + barcode.ErrorDescription); return false; EndIf; //Make sure the name of the picture object here and in the design match fig=Area.Pictures.PictureBarcode; fig.PictureSize=PictureSize.Proportional; fig.Line = New Line(LineTypePatternDocumentDrawing.NoLine); //There should not be a frame around the barcode.Picture = New Image(FileName);//Loading a picture with a barcode //The same file name is specified as in SavePicture TabDoc.Output(Area); DeleteFiles(FileName);//Delete temporary image file Return TabDoc; EndFunction &OnClient ProcedureCommandProcess(CommandParameter, CommandExecutionParameters) TabDoc1=DocumentOnServer(); If TabDoc1<>False Then TabDoc1.Show(); EndIf; EndProcedure

Report module notes:

To make a call successfully GetCOMObject() don't forget to install the StrokeScribe software. When working in client-server mode, StrokeScribe must be installed on the server. StrokeScribe does not need to be installed on client PCs.

Call GetTemporaryFileName() required to get an arbitrary name of the intermediate file in which the barcode image will be saved before transferring it to a spreadsheet document. The file must exist before the call TabDoc.Output(Region). After that, the temporary file can be deleted. If you plan to create several barcodes in one area, then a separate temporary file must be created for each barcode. Because SavePicture saves a barcode in WMF format, the corresponding extension is assigned to the generated file.

If desired, a fixed file name can also be used, for example: FileName="c:\temp\barcode.wmf". Of course, the folder "c:\temp" must exist and be available for file creation.

Assignment barcode.Alphabet= sets the barcode format. Barcode type constants are available in the documentation. Examples of creating the most common barcodes are shown below.

Data assigned barcode.Text, depend on the barcode format. For example, EAN-13 cannot display letters and has a fixed length, while CODE 128 does not work with Cyrillic. If StrokeScribe cannot process the string, then a non-zero value will be written to the Error property. The module uses simplified error checking - the result of all operations together is placed in a variable code: code=barcode.SavePicture().

The SavePicture() call saves the barcode image to a temporary file. Specifying 7 in the second parameter of the SavePicture() call will create a vector scalable image in WMF format. The commercial version of StrokeScribe also includes JPG, PNG, GIF, BMP24, and EMF formats. Creating barcode bitmaps is not recommended due to the large amount of data and poor scalability, but can be used if the thin client does not support WMF.

In construction If the code<>0 the result of saving the barcode image in the file is checked. The code will be non-zero even if a non-existent barcode type is specified or in the property Text sent data that is not displayed by the selected type of barcode. Text explanation for the error code is available in the property ErrorDescription. The result of each operation on the barcode object can be additionally controlled by checking the value of the Error property.

To display multiple barcodes, it is enough to organize a cyclic assignment Text=, Alphabet=(optional) and method call SavePicture. Each call to SavePicture must be made with a separate filename for each barcode within the same area prior to calling TabDoc.Output(). After the area is displayed, the files can be deleted.

Below are examples of how to create some common barcode formats. Since some of the formats have additional settings, we recommend that you refer to the pages focused on a specific barcode format (see the site menu on the left) and to the documentation on StrokeScribe properties.

Please note- version 1C:Enterprise 8.2.12.96, on which testing was performed, incorrectly centers WMF images, shifting them to the right. Therefore, it is not recommended to reduce barcode clean zones (HBorderSize and QuietZone2D properties) in order to avoid losing part of the barcode lines.

Barcode.Alphabet=3; //EAN13 barcode.Text="123456789012"; code=barcode.SavePicture(FileName, 7, 100, 60);

Barcode.Alphabet=5; //CODE128 barcode.Text="123ABC" + Symbol(9) + "def"; code=barcode.SavePicture(FileName, 7, 100, 60);

Symbol(9)- 1C language feature - encodes a tab character (ASCII TAB). All unreadable characters are displayed as * in the barcode signature. CODE 128 allows you to set custom signature text that will be displayed under the barcode instead of the standard display of encoded data:

Barcode.Alphabet=7; //ITF14 barcode.Text="1234567890123"; barcode.ITF14BearerBox=1; code=barcode.SavePicture(FileName, 7, 100, 30);

Property ITF14BearerBox outputs ITF-14 with the rectangular frame commonly found on corrugated container dies. To display a barcode with only horizontal security lines, specify ITF14BearerBox=0.

Detailed examples on creating GS1 strings can be found here. For a list of formats supported by GS1 identifiers, see the Compatibility List.

Modify the source code of the module as shown below:

Barcode.Alphabet=17; //EAN128 GS = Symbol(29); barcode.Text="10" + "1234" + GS + "3301" + "123456" + "17" + "010517"; barcode.ITF14BearerBox=1; code=barcode.SavePicture(FileName, 7, 100, 30);

Large amounts of data in GS1 format can be stored in 2D GS1 DATAMATRIX barcodes.

Barcode.Alphabet=8; //DATAMATRIX barcode.Text="123abcDEF"; code=barcode.SavePicture(FileName, 7, 100, 100);

To print the Aztec code, modify the source code of the module as shown below:

Barcode.Alphabet=33; //AZTEC barcode.Text="123ABcd"; code=barcode.SavePicture(FileName, 7, 100, 100);

The example given here is for generating a QR code for mobile applications. Most warehouse and office applications in Russia (when recognized by specialized scanners) require direct transmission of text in the CP1251 code page. To do this, set UTF8=0. Installation QrECL shown here as an example and is not mandatory.

Barcode.Alphabet=25; //QRCODE barcode.Text="Cyrillic"; barcode.UTF8=1; barcode.QrECL=2; code=barcode.SavePicture(FileName, 7, 100, 100);

Barcode printing is a must-have feature for every entrepreneur. Barcodes must contain all necessary information about the product. Thanks to the 1C program, the accounting department has the opportunity, using the database, to quickly and efficiently print barcodes. In order to use this functionality, you must have "1C: Enterprise 8". In this article, we will talk about how to install a module designed for printing barcodes, as well as describe the process of working with it.

Component installation

1c barcode printing is possible only after installing the appropriate component. If it is missing, when you try to print, an error will pop up with the text: "The 1C barcode printing component is not installed on this computer." This error is typical for 1C programs versions 8.2 and 8.3.

How to install a barcode in 1s? Many people ask this question, but the answer to it is very simple. In order to install the appropriate module, you must perform a series of sequential steps.

  • Download the component from the 1C website;
  • Unpack the archive;
  • Perform installation.

Thus, the first thing you need to do is download the 1CBarCode.exe file, which you can find in an archived form at http://users.v8.1c.ru/.

Following the link, you will see a table of various components, where the version of the program will be indicated in the second column. You need to find a component called "1C: Barcode Printing" version 8.0.15.2 and click on the "download" button.

Tip: If you have installation disk program 1C: Accounting, you can find the installation file of the component in the directory: Disk\1CITS\EXE\TradeWare\1C\1CBarCode

After downloading, all you have to do is unzip the file and start the installation by double-clicking on the 1CBarCode exe file. As a rule, it does not take much time. After installation, the error when trying to generate barcodes should disappear.

If the error persists, you should try to reinstall the 1C program, or update it to the latest current version. After that, the error will not appear, and you will be able to create and print the barcodes you need.

Component Functions

As mentioned above, 1c barcode printing 1cbarcode exe is designed to help accountants and entrepreneurs. The functionality of the module allows you to print barcodes of all used formats. Including:

  • AN8;AddOn2;
  • RSS 14;
  • Code 39 Full ASCII;
  • EAN 128;
  • CodaBar, PDF 417;
  • Code16k Industrial 2of5;
  • EAN13;
  • EAN13 AddOn5;
  • ITF 14;
  • Code 39;
  • Code 93;
  • Code 128;
  • Code16k Industrial 2of5;
  • Interleaved 2of5.

The module also has a function that allows the program to automatically determine the desired format. The component also allows you to transfer the value of a barcode in symbolic form, together with a control character, and also without a control character. If desired, it is possible to print barcodes from 1s without displaying a control character on the final image.

Additional features are also available to make printing easier. In order to control whether the dashed lines enter the printable area, the following minimum width and height settings are applied. Thanks to their adjustment, you can achieve complete coverage of all the necessary information on the final sheet.

Important: Detailed description you can find the properties and methods of the component in the program reference.

Decor

In order to perform a barcode print 1s with the highest quality, you should use the functionality of the component, which allows you to customize the design of the barcode. It is possible to set the text that will be displayed on the surface of the sheet. This text is set independently of the rest of the content. In addition, you can customize the font, text position (it can be placed above or below the dashed lines), as well as text display features.

The user can select color scheme, since the following are available for adjustment:

  • Text color;
  • Background color;
  • Dashed line color.

If desired, the background can also have no color and be transparent. Additionally, it can adjust the angle of rotation of the barcode and text, as well as specify its offset along two axes: horizontal and vertical. The volume of the field around the dashed lines is also regulated.

How to work with a component?

1s barcode printing component works in the same way as other modules of the 1C: Accounting program. To work, you need to use various properties and methods. Each property has a certain number of values, individual for each property.

For example, the "typecode" property can take the following values:

  • 0 - EAN8 format;
  • 1 - EAN13 format;
  • 2 - EAN128 format;
  • 3 - CODE39 format;
  • 4 - CODE128 format;
  • 5 - CODE16K format;
  • 6 - PDF417 format;
  • 7 - Industrial2of5 format.

Methods can also contain certain parameters that affect appearance final line sheet.

A barcode is a sequence of white and black bars that displays specific information. This is one of the most common identification systems used throughout the world. The code usually consists of 13 digits.


Download a special font for barcode printing in 1C:Enterprise. To do this, follow the link and download the Eangnivc.ttf file. Next, copy it to the standard font folder operating system. Typically, this is the Windows/Fonts directory.

If the barcode is installed on the system but does not print in the program, go to the font directory. Find this file there and double-click on it with the left mouse button. This action will activate it and allow you to use the barcode in 1C.

Install the barcode in the "Retail and Warehouse" configuration. In this case, you must use the ActiveBarcode component. Go to the folder with the 1C: Enterprise database, find the installation file there, which is called Barcod.ocx.

Copy it to the C:/Windows/System32 folder. Next, using the "Start" button, go to the main menu, click on the "Run" item. Enter the following command in the box: Regsvr32.exe C:/Windows/System32/barcode.ocx, click OK.

Perform 2D barcode setup. This code is used in the 1C: Accounting program to print tax returns. Go to the cover page, then open the second tab and check the "Print 2D barcode" box.

Next, click on the "Print" button, select the "Print all sheets" or "Show all sheets" value. The program will generate the file and then convert it to a two-dimensional barcode. It will be divided into declaration sheets. Run the Setup.barcodelib.exe file as an administrator.

How to connect a barcode in 1s

The barcode scanner is a fairly common device. When connected to the 1C program, you can search for goods through the "nomenclature" directory, change product barcodes, automatically register purchases in cashier mode, and automatically fill out various documents. Thus, the use of a barcode greatly simplifies the work with scribbled goods in 1C.

Instruction

Choose a barcode scanner to work with 1C. They may differ in the way they are read and the connection interface. The most optimal and convenient option is a hand-held scanner with a COM port, since it is convenient to bring it to the product, and drivers for such a connection interface are supplied with the 1C configuration.

Locate the driver file in the infobase directory, which is named scanopos.dll. Check that its settings match the barcode scanner you purchased. In some cases, this driver may not work with a COM port connection higher than 9. Detailed information can be obtained from software vendors or on special sites on the Internet. Download the required driver if necessary.

Run the software configuration "1C: Trade Management" or "1C: Retail". Go to the "Service" menu, select the section "Setting up commercial equipment" and go to the "Barcode scanner" tab. Check the box to enable hardware and specify its model. Click the "Connect" button and confirm the action by clicking "OK".

Go to the "Options" section of the "Tools" menu. If you did everything correctly, you will see the "Barcode Scanner" tab. Set the parameters that match the equipment you purchased. Specify the port number, data bits, speed, number of stop bits, and check the boxes next to enable and hardware flow control. Click the "Apply" and "OK" button.

Check scanner operation. To do this, go to the reference book "Nomenclature" and read any barcode. If the message “Item with this barcode was not found” appears in the window, it means that the connection has been made correctly and you can start working. Otherwise, make corrections in the barcode scanner settings.

Sometimes, as part of barcoding documents or labels, it is necessary to display an arbitrary barcode on a 1C 8.2 (8.3) printed form.

How to do this, consider below.

To display a barcode Necessarily (except for configurations based on BSP 2 and above), the installation of the component is required. You can find it on the ITS disk or on the 1C user portal.

Inserting a barcode on a printed form 1C

The first step is to create a new object - a drawing. To do this, in the layout you need to click Table - Pictures - Insert object ... The system will prompt you to select the type of object:

Get 267 1C video lessons for free:

Need to choose Control element1С.V8.Printing barcodes. Let's say we call the drawing-object "Barcode". For programmatic output to a printed form, you can use the following code:

CodeType = GetBarcodeTypeValueForEU(CharacteristicTypesPlans.BarcodeTypes.Code39) ; If CodeType = - 1 Then General Purpose. report a bug( "For barcode format """ + Plans of Views of Characteristics. Types of Barcodes. EAN13 + "" "there is no corresponding type in the ES""1C: Barcode printing"". | Position will be skipped") ; EndIf ; Region. Drawings. Barcode. An object. CodeType = CodeType; Region. Drawings. Barcode. An object. Message = ? (EmptyString("" ) , Barcode, "" ) ; Region. Drawings. Barcode. An object. CodeText = Barcode;


close