{"@attributes":{"version":"2.0"},"channel":{"title":"Documentation \u2013 Barcode Generation","link":"https:\/\/docs.aspose.com\/barcode\/phpjava\/generate-barcodes\/","description":"Recent content in Barcode Generation on Documentation","generator":"Hugo -- gohugo.io","item":[{"title":"Phpjava: Customize Barcode Appearance","link":"https:\/\/docs.aspose.com\/barcode\/phpjava\/customize-barcodes\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/docs.aspose.com\/barcode\/phpjava\/customize-barcodes\/","description":"\n        \n        \n        <p>In the present article, you can find details about customizing various parameters of barcodes to be generated, such as barcode label size, rotation angle, barcode paddings, and barcode image borders.<\/p>\n\n\n<div class=\"alert alert-primary\" role=\"alert\">\n\n<em>If you need any clarifications, feel free to reach out <a href=\"https:\/\/docs.aspose.com\/barcode\/barcode\/phpjava\/technical-support\/\">Aspose Technical Support<\/a>: ask your questions at <a href=\"https:\/\/forum.aspose.com\/c\/barcode\/13\">Aspose.Barcode Forum<\/a> or contact <a href=\"https:\/\/helpdesk.aspose.com\/\">Aspose Paid Support Helpdesk<\/a>.<\/em>\n<\/div>\n\n<h2 id=\"overview\"><strong>Overview<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> provides class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeGenerator\"><em>BarcodeGenerator<\/em><\/a> to generate barcodes in line with the predefined settings so that each element of a barcode image gets its fixed position relatively to other elements, as shown in the scheme below. A barcode label comprises the following parts: barcode text, bars, top and bottom captions, image borders, and paddings. All elements besides barcode bars are optional.<\/p>\n<p align=\"center\"><img src=\"barcode_view_scheme.png\"><\/p>\n<h2 id=\"barcode-image-sizing-modes\"><strong>Barcode Image Sizing Modes<\/strong><\/h2>\n<p>In general, <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> defines barcode image size in terms of height and width automatically. The library enables developers to manage image size settings manually by determining the height and width of barcode labels using <em>setImageHeight (Unit $value)<\/em> and <em>setImageWidth (Unit $value)<\/em> functions of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBaseGenerationParameters\"><em>BaseGenerationParameters<\/em><\/a>.<\/p>\n<p>Barcode image size can be varied by using varios sizing modes that can be enabled using the <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classAutoSizeMode\"><em>AutoSizeMode<\/em><\/a> class . <em>AutoSizeMode<\/em> provides the following options: <em>NONE<\/em>, <em>NEAREST<\/em>, and <em>INTERPOLATION<\/em>. In <em>Interpolation<\/em> and <em>Nearest<\/em> modes, barcode image size is managed based on the values of width and height, and other parameters are ignored. In turn, when the <em>None<\/em> mode is enabled, barcode image size is defined ignoring width and height; instead, other parameters, such as <em>XDimension<\/em>, are used. <em>AutoSizeMode<\/em> takes the <em>NONE<\/em> value by default.<\/p>\n<p>Further in the article, different barcode sizing modes are discussed.<\/p>\n<h3 id=\"autosizemodenone\"><strong>AutoSizeMode.None<\/strong><\/h3>\n<p>As outlined above, setting the <em>None<\/em> mode implies that barcode image size is managed based on different parameters ignoring width and height. To specify barcode size, class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeParameters\"><em>BarcodeParameters<\/em><\/a> provides a special function called <em>setXDimension (Unit $value)<\/em>. It is used to define the minimum size of bars in 1D barcodes or cells in 2D barcodes. Other barcode sizing parameters are calculated based on the <em>XDimension<\/em> value.<\/p>\n<p>Various barcode standards often determine <em>XDimension<\/em> to provide compatibility between printing and scanning equipment units so that barcode images could be captured by scanners used in various companies. <em>XDimension<\/em> is related to the data density of a barcode type, meaning that it determines the amount of data that can be encoded in one barcode. Setting a small value of <em>XDimension<\/em> results in covering less space to place each encoded character in a barcode image. In contrast, setting a bigger value of <em>XDimension<\/em> leads to enlarging the area required to encode each character and decreasing the number of characters per inch.<\/p>\n<p>The barcode label shown below has been generated using the <em>None<\/em> mode.<\/p>\n<p align=\"center\"><img src=\"autosizemodenone.png\"><\/p>\n<h3 id=\"autosizemodeinterpolation\"><strong>AutoSizeMode.Interpolation<\/strong><\/h3>\n<p>Setting <em>AutoSizeMode.INTERPOLATION<\/em> means that only the values specified using <em>setImageHeight (Unit $value)<\/em> and <em>setImageWidth (Unit $value)<\/em> functions are used to set the barcode size. In this case, barcode image size is determined using the manually specified values of height and width even when it results in producing distorted barcode proportions and the deterioration of barcode readability. The <em>Interpolation<\/em> mode is appropriate to create barcode images with the resolution of 300 dpi or higher. Using such resolution will allow keeping barcode distortions negligible and avoiding the descrease of barcode readability.<\/p>\n<p>The barcode label generated through the <em>Interpolation<\/em> mode is demonstrated below.<\/p>\n<p align=\"center\"><img src=\"autosizemodeinterpolation.png\"><\/p> \n<h3 id=\"autosizemodenearest\"><strong>AutoSizeMode.Nearest<\/strong><\/h3>\n<p>To set barcode image size, the <em>Nearest<\/em> mode uses only the values specified using <em>setImageHeight (Unit $value)<\/em> and <em>setImageWidth (Unit $value)<\/em> functions of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBaseGenerationParameters\"><em>BaseGenerationParameters<\/em><\/a> similarly to the <em>Interpolation<\/em> mode. In this mode, <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeGenerator\"><em>BarcodeGenerator<\/em><\/a> aims at finding the most suitable image size to avoid barcode proportion distortion and readability deterioration.<\/p>\n<p>The barcode label created through the <em>Nearest<\/em> mode is provided below.<\/p>\n<p align=\"center\"><img src=\"autosizemodenearest.png\"><\/p>\n<h2 id=\"barcode-rotation\"><strong>Barcode Rotation<\/strong><\/h2>\n<p>In <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em>, barcode image rotation can be set through the <em>setRotationAngle (float $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBaseGenerationParameters\"><em>BaseGenerationParameters<\/em><\/a>. Passing a value in degrees to this function allows generating a barcode image rotated at the desired angle clockwise or counterclockwise.<\/p>\n<p>The sample barcode labels rotated by various angles are shown below.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Rotation Angle<\/th>\n<th style=\"text-align:center\">Is Set to +90\u00b0<\/th>\n<th style=\"text-align:center\">Is Set to -90\u00b0<\/th>\n<th style=\"text-align:center\">Is Set to +45\u00b0<\/th>\n<th style=\"text-align:center\">Is Set to -45\u00b0<\/th>\n<th style=\"text-align:center\">Is Set to 180\u00b0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"rotationangle+90.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"rotationangle-90.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"rotationangle+45.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"rotationangle-45.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"rotationangle180.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"customizing-barcode-borders-and-padding\"><strong>Customizing Barcode Borders and Padding<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> allows customizing barcode image borders and paddings. Corresponding functions are described further.<\/p>\n<h3 id=\"border-settings\"><strong>Border Settings<\/strong><\/h3>\n<p>Applying default border settings results in generating barcode images without borders. Alternatively, they can be defined manually using five styles: solid, dotted, dashed, dash-dot, and dash dot dot. The border style can be modified using special class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBorderParameters\"><em>BorderParameters<\/em><\/a>. In addition, this class allows setting border thickness in any available units and colors using <em>setWidth (Unit $value)<\/em> and <em>setColor (string $hexValue)<\/em> functions. Border styles can be changed using the <em>setDashStyle (int $value)<\/em> function of the same class.<\/p>\n<p>Barcode labels demonstrated below have been generated using different border styles.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Border Style<\/th>\n<th style=\"text-align:center\">Solid<\/th>\n<th style=\"text-align:center\">Dashed<\/th>\n<th style=\"text-align:center\">Dotted<\/th>\n<th style=\"text-align:center\">Dash Dot<\/th>\n<th style=\"text-align:center\">Dash Dot Dot<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"bordersolid.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"borderdash.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"borderdot.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"borderdashdot.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"borderdashdotdot.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"paddings\"><strong>Paddings<\/strong><\/h3>\n<p>Paddings from the edges of a barcode image or its borders can be set in four directions using a special class called <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classPadding\"><em>Padding<\/em><\/a> and its functions: <em>setLeft (Unit $value)<\/em>, <em>setRight (Unit $value)<\/em>, <em>setTop (Unit $value)<\/em>, and <em>setBottom (Unit $value)<\/em>. By default, the padding value is set to 5 points in all directions.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Padding<\/th>\n<th style=\"text-align:center\">Millimeters<\/th>\n<th style=\"text-align:center\">Pixels<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"padding10millimeters.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"padding10pixels.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"bar-width-reduction\"><strong>Bar Width Reduction<\/strong><\/h2>\n<p>The other important property that needs to be determined accurately is bar width. Setting an approriate value of this parameter is critical to assure successful barcode scanning. Due to the so-called ink floating phenomenon, some barcode printing techniques may result in increasing actual bar width after printing out barcode images. This happens often in commercial printing in cases when conventional printing presses are used. To ensure that printed barcode images will be printed out with appropriate bar width, setting a bar width reduction value may be required.<\/p>\n<p>Bar width reduction is a way to mitigate the effecet of ink floating in a graphic design file of a barcode. <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> allows modifying bar width through the <em>setBarWidthReduction (Unit $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeParameters\"><em>BarcodeParameters<\/em><\/a>. Passing the required value while calling this function allows decreasing bar width in 1D barcodes or cell size in 2D barcodes. To find out the suitable BWR value for a printer, it is necessary to check special tables provided by printer manufacturers. Modifying this parameter is not applicable to laser printers.<\/p>\n<p>The sample barcodes shown below have been generated with and without applying bar width reduction.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Barcode Type<\/th>\n<th style=\"text-align:center\">Bar Width Reduction 0<\/th>\n<th style=\"text-align:center\">Bar Width Reduction 3<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><strong>Code 128<\/strong><\/td>\n<td style=\"text-align:center\"><img src=\"code128barwidthreduction0.png\" width=\"50%\" height=\"50%\"><\/td>\n<td style=\"text-align:center\"><img src=\"code128barwidthreduction3.png\" width=\"50%\" height=\"50%\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\"><strong>Data Matrix<\/strong><\/td>\n<td style=\"text-align:center\"><img src=\"datamatrixbarwidthreduction0.png\" width=\"50%\" height=\"50%\"><\/td>\n<td style=\"text-align:center\"><img src=\"datamatrixbarwidthreduction4.png\" width=\"50%\" height=\"50%\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n      "},{"title":"Phpjava: Manage Barcode Parameters","link":"https:\/\/docs.aspose.com\/barcode\/phpjava\/set-barcode-parameters\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/docs.aspose.com\/barcode\/phpjava\/set-barcode-parameters\/","description":"\n        \n        \n        <p>This article describes how to manage settings provided by <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> to adjust barcode measurement units (millimeters, inches, points, or pixels) and barcode image resolution.<\/p>\n<h2 id=\"overview\"><strong>Overview<\/strong><\/h2>\n<p>Cartesian coordinate systems use coordinates of pixels or drawable objects to represent image data for raster or vector images. To link these coordinates to real-world measurement units, such as millimeters or inches, <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> includes a special class called <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classUnit\"><em>Unit<\/em><\/a>. Class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classUnit\"><em>Unit<\/em><\/a> provides various functions that serve to convert barcode size values defined in pixels, millimeters, inches, or points to any of the supported measurement units automatically. In this way, the size of elements in real-world measurement units can be converted into pixels to generate barcode images.<\/p>\n\n\n<div class=\"alert alert-primary\" role=\"alert\">\n\n<em>If you need any clarifications, feel free to reach out <a href=\"https:\/\/docs.aspose.com\/barcode\/barcode\/phpjava\/technical-support\/\">Aspose Technical Support<\/a>: ask your questions at <a href=\"https:\/\/forum.aspose.com\/c\/barcode\/13\">Aspose.Barcode Forum<\/a> or contact <a href=\"https:\/\/helpdesk.aspose.com\/\">Aspose Paid Support Helpdesk<\/a>.<\/em>\n<\/div>\n\n<h2 id=\"measuring-barcode-size-in-various-units\"><strong>Measuring Barcode Size in Various Units<\/strong><\/h2>\n<p>Class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classUnit\"><em>Unit<\/em><\/a> allows developers to set measurement units for barcode parameters and can be modified using functions of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeParameters\"><em>BarcodeParameters<\/em><\/a>, such as <em>setBarCodeHeight (Unit $value)<\/em>, <em>setBarCodeWidth (Unit $value)<\/em>, and <em>setXDimension (Unit $value)<\/em>. <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> determines measurement units in the <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classGraphicsUnit\"><em>GraphicsUnit<\/em><\/a> enum. Class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classUnit\"><em>Unit<\/em><\/a> can be used to convert measurement units into the desired ones: <em>Millimeters<\/em>, <em>Pixels<\/em>, <em>Inches<\/em>, <em>Point<\/em> (1\/72 inch), or <em>Document<\/em> (1\/300 inch). By default, <em>Millimeters<\/em> are used as size measurement units.<\/p>\n<p>Barcode labels created using various unit settings are shown below.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Size Units<\/th>\n<th style=\"text-align:center\">Pixels<\/th>\n<th style=\"text-align:center\">Millimeters<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><image src=\"unitin3pixels.png\"><\/td>\n<td style=\"text-align:center\"><image src=\"unitin2millimeters.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"image-resolution\"><strong>Image Resolution<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> allows developers to customize barcode image resolution settings using class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classUnit\"><em>Unit<\/em><\/a>. This class includes the <em>setPixels (float $value)<\/em> function to convert all non-pixel size measurements into digital coordinates in pixels. To convert size values into requested supported untis, the following functions need to be used: <em>setInches (float $value)<\/em>, <em>setMillimeters (float $value)<\/em>, <em>setDocument (float $value)<\/em>, <em>setPoint (float $value)<\/em>, and <em>setPixels (float $value)<\/em>.<\/p>\n<p>Barcode images with different resolution settings are given below.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Resolution<\/th>\n<th style=\"text-align:center\">Is Set to 96 dpi<\/th>\n<th style=\"text-align:center\">Is Set to 300 dpi<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><image src=\"unitin1millimeterresolution96.png\"><\/td>\n<td style=\"text-align:center\"><image src=\"unitin1millimeterresolution300.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n      "},{"title":"Phpjava: Set Barcode Text","link":"https:\/\/docs.aspose.com\/barcode\/phpjava\/set-barcode-text\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/docs.aspose.com\/barcode\/phpjava\/set-barcode-text\/","description":"\n        \n        \n        <p>This article describes how to work with text placed on barcode images. <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> enables customizing various parameters of barcode text: visibility, font, spacings, text location, and wrapping modes.<\/p>\n\n\n<div class=\"alert alert-primary\" role=\"alert\">\n\n<em>If you need any clarifications, feel free to reach out <a href=\"https:\/\/docs.aspose.com\/barcode\/barcode\/phpjava\/technical-support\/\">Aspose Technical Support<\/a>: ask your questions at <a href=\"https:\/\/forum.aspose.com\/c\/barcode\/13\">Aspose.Barcode Forum<\/a> or contact <a href=\"https:\/\/helpdesk.aspose.com\/\">Aspose Paid Support Helpdesk<\/a>.<\/em>\n<\/div>\n\n<h2 id=\"overview\"><strong>Overview<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> allows developers to add human-readable text on barcode images in three different forms shown in the scheme below: main text label, top caption, and bottom caption. Any of these elements can be placed optionally or hidden.<\/p>\n<p align=\"center\"><img src=\"barcode_text_scheme.png\"><\/p>\n<h2 id=\"barcode-text\"><strong>Barcode Text<\/strong><\/h2>\n<p>The main barcode text label contains short text information detached from bars by spacings. This text label can take six positions, as explained in the figure below: top center, top left, top right, bottom center, bottom left, or bottom right.<\/p>\n<p align=\"center\"><img src=\"codetext_scheme.png\"><\/p>\n<h3 id=\"text-visibility\"><strong>Text Visibility<\/strong><\/h3>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> allows developers to visualize or hide barcode text. If there is no need to put human-readable text on a barcode image, barcode images can be generated without text labels, as shown below.<\/p>\n<p align=\"center\"><img src=\"codetexthide.png\"><\/p>  \n<h3 id=\"text-positioning\"><strong>Text Positioning<\/strong><\/h3>\n<p>The position of a barcode text label can be modified by customizing two parameters: alignment and location. These parameters can be set using <em>setLocation (int $value)<\/em> and <em>setAlignment (int $value)<\/em> functions of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCodetextParameters\">CodetextParameters<\/a>.<\/p>\n<h4 id=\"location\"><strong>Location<\/strong><\/h4>\n<p>The <em>setLocation (int $value)<\/em> function allows setting the vertical position of a text label, namely, placing it above or below bars, as shown in figures below. The default setting is <em>Below<\/em>.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Text Location<\/th>\n<th style=\"text-align:center\">Above Barcode<\/th>\n<th style=\"text-align:center\">Below Barcode<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextlocationabove.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextlocationbelow.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"alignment\"><strong>Alignment<\/strong><\/h4>\n<p>The <em>setAlignment (int $value)<\/em> function is used to set the horizontal position of a text label in a barcode image: right-side, left-side, or center, as illustrated in figures below. The default setting of barcode text alignment is <em>CENTER<\/em>.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Text Alignment<\/th>\n<th style=\"text-align:center\">Left<\/th>\n<th style=\"text-align:center\">Center<\/th>\n<th style=\"text-align:center\">Right<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextaligmentleft.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextaligmentcenter.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextaligmentright.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"spacing-between-bars-and-text-label\"><strong>Spacing between Bars and Text Label<\/strong><\/h3>\n<p>The default spacing (gap) between bars and a text label is equal to 2pt. It is possible to modify this spacing using the <em>setSpace (Unit $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCodetextParameters\"><em>CodetextParameters<\/em><\/a>. This function does not apply to several barcode types, including EAN-13, EAN-8, UPC-E, UPC-A, ISMN, ISBN, ISSN, and UpcaGs1DatabarCoupon.<\/p>\n<p>Sample barcode images shown below have been created with various spacing settings (five and forty pixels).<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Text Spacing<\/th>\n<th style=\"text-align:center\">Is Set to 5 Pixels<\/th>\n<th style=\"text-align:center\">Is Set to 40 Pixels<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextspace5pixels.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextspace40pixels.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"font-settings\"><strong>Font Settings<\/strong><\/h3>\n<p>To manage barcode text font, <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> provides <em>setFont (FontUnit $value)<\/em> and <em>setFontMode (int $value)<\/em> functions of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCodetextParameters\"><em>CodetextParameters<\/em><\/a>. The default font setting is Arial 5pt regular. This setting is ignored if the <em>Auto<\/em> mode is enabled using the <em>setFontMode (int $value)<\/em> function. This function is used to manage font size settings automatically. If it is called passing the <em>Auto<\/em> value, font size is determined automatically based on <em>xDimension<\/em> in such a way that the text label should take only one text line. <em>FontMode.AUTO<\/em> is recommended when <em>AutoSizeMode.NEAREST<\/em> or <em>AutoSizeMode.INTERPOLATION<\/em> settings are enabled. Alternatilvely, setting <em>FontMode.MANUAL<\/em> allows managing font size manually. Other font parameters, including font style, are set similarly in both <em>Auto<\/em> and <em>Manual<\/em> modes.<\/p>\n<p>Barcode images shown below have been created with these two font modes.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Font Setting Mode<\/th>\n<th style=\"text-align:center\">Auto<\/th>\n<th style=\"text-align:center\">Manual<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextfontmodeauto.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextfontmodemanual.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"nowrap-mode-for-text\"><strong>NoWrap Mode for Text<\/strong><\/h3>\n<p>It is possible to avoid line breaks in text that is too long for a single row using the <em>setNoWrap (bool $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCodetextParameters\"><em>CodetextParameters<\/em><\/a>. When the <em>True<\/em> setting is enabled, the text label is displayed in a single row regardless of the text length. The default setting is <em>False<\/em>. Barcode images shown below have been created with different <em>NoWrap<\/em> settings.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Text Wrapping Mode<\/th>\n<th style=\"text-align:center\">Wrap<\/th>\n<th style=\"text-align:center\">No Wrap<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextlongtextwrap.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"codetextlongtextnowrap.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"replacing-barcode-text-in-2d-barcodes\"><strong>Replacing Barcode Text in 2D Barcodes<\/strong><\/h2>\n<p>To replace barcode text in 2D barcodes with some other text label with improved readability without modifications of the barcode image itself, it is possible to call the <em>setTwoDDisplayText (string $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCodetextParameters\"><em>CodetextParameters<\/em><\/a> and pass new text to be placed. This is applicable to selected 2D types, including QR Code, Aztec, DataMatrix, MaxiCode, PDF417, and DotCode.<\/p>\n<p>The sample barcode image shown below has been created using the <em>TwoDDisplayText<\/em> setting.<\/p>\n<p align=\"center\"><img src=\"codetexttwoddisplaytext.png\"><\/p>\n<h2 id=\"caption\"><strong>Caption<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> allows developers to place additional text labels in a barcode image in form of captions above and below barcodes. As demonstrated in the figure below, such text captions have a parameter called <em>Padding<\/em> that allows modifying spacing size between captions and the nearest element (barcodes, main text label, or borders). Both text captions are disabled by default. If required, they can be shown by one or both simulteneously.<\/p>\n<p align=\"center\"><img src=\"caption_scheme.png\"><\/p>\n<h3 id=\"caption-visibility\"><strong>Caption Visibility<\/strong><\/h3>\n<p>As stated above, additional text captions <em>CaptionAbove<\/em> and <em>CaptionBelow<\/em> are disabled by default. When required, top and bottom caption labels can be enabled. The <em>setVisible (bool $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCaptionParameters\"><em>CaptionParameters<\/em><\/a> can be used to display captions. Then, caption text can be inserted through the <em>setText (string $value)<\/em> function. If required, caption labels can replace main text in 1D barcodes by enabling the former and disabling the latter. Figures given below demonstrate how caption positioning options can be managed.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Caption Visibility<\/th>\n<th style=\"text-align:center\">Above<\/th>\n<th style=\"text-align:center\">Below<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"captionvisibleabove.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"captionvisiblebelow.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"text-positioning-1\"><strong>Text Positioning<\/strong><\/h3>\n<p>The <em>setAlignment (int $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCaptionParameters\"><em>CaptionParameters<\/em><\/a> allows modifying horizontal positions of caption labels in three directions: right, left, and center. The default position of captions is center. Figures shown below demonstrate barcode images with the top caption label with different alignment positions.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Caption Alignment<\/th>\n<th style=\"text-align:center\">Left<\/th>\n<th style=\"text-align:center\">Center<\/th>\n<th style=\"text-align:center\">Right<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"captionalignmentleft.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"captionalignmentcenter.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"captionalignmentright.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"caption-padding\"><strong>Caption Padding<\/strong><\/h3>\n<p>The <em>setPadding (Padding $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCaptionParameters\"><em>CaptionParameters<\/em><\/a> can be used to manage spacings for text captions. By default, the spacinng value is set to {5pt; 5pt; 0; 5pt} for the top caption and {0; 5pt; 5pt; 5pt} for the bottom one according to the standard Rectangle setting {Top, Left, Bottom, Right}. This function does not apply when captions are disabled. Barcode images shown below have been generated with different padding settings.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Caption Padding<\/th>\n<th style=\"text-align:center\">Is Set to 5 Pixels<\/th>\n<th style=\"text-align:center\">Is Set to 40 Pixels<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"captionpadding5pixels.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"captionpadding40pixels.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"caption-font\"><strong>Caption Font<\/strong><\/h3>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> does not enable automatic font size setting based on barcode size. Accordingly, caption font size requires manual setting. For top and bottom captions, various parameters, including font style and size can be set independently. Caption font can be customized using functions of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classFontUnit\"><em>FontUnit<\/em><\/a>. The default setting for caption font is Arial 8pt regular.\nThe barcode image shown below explains different caption font settings.<\/p>\n<p align=\"center\"><img src=\"captionfont.png\"><\/p>\n<h3 id=\"nowrap-mode-for-caption\"><strong>NoWrap Mode for Caption<\/strong><\/h3>\n<p>The <em>setNoWrap (bool $value)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCaptionParameters\"><em>CaptionParameters<\/em><\/a> allows disabling text line breaks when a text string is too large to fit in one line. When this function is called passing the <em>True<\/em> value, caption text is always displayed as a single line. Barcode images below show the difference between <em>setNoWrap.TRUE<\/em> and <em>setNoWrap.FALSE<\/em> settings.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Caption Wrapping<\/th>\n<th style=\"text-align:center\">Is Set to <em>Wrap<\/em><\/th>\n<th style=\"text-align:center\">Is Set to <em>No Wrap<\/em><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><img src=\"captiontextwrap.png\"><\/td>\n<td style=\"text-align:center\"><img src=\"captiontextnowrap.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n      "},{"title":"Phpjava: Modify Barcode Color Scheme","link":"https:\/\/docs.aspose.com\/barcode\/phpjava\/modify-barcode-color\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/docs.aspose.com\/barcode\/phpjava\/modify-barcode-color\/","description":"\n        \n        \n        <p>In this article, the options available in <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> to manage barcode color scheme and its key elements are descsribed.<\/p>\n\n\n<div class=\"alert alert-primary\" role=\"alert\">\n\n<em>If you need any clarifications, feel free to reach out <a href=\"https:\/\/docs.aspose.com\/barcode\/barcode\/phpjava\/technical-support\/\">Aspose Technical Support<\/a>: ask your questions at <a href=\"https:\/\/forum.aspose.com\/c\/barcode\/13\">Aspose.Barcode Forum<\/a> or contact <a href=\"https:\/\/helpdesk.aspose.com\/\">Aspose Paid Support Helpdesk<\/a>.<\/em>\n<\/div>\n\n<h2 id=\"overview\"><strong>Overview<\/strong><\/h2>\n<p>Usually barcode images have the black-and-white color scheme. To provide the possibilty of modifying barcode colors, <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> enables customizing system RGB colors for key barcode elements, including the following:<\/p>\n<ul>\n<li>Bars<\/li>\n<li>Background<\/li>\n<li>Text label<\/li>\n<li>Top and bottom captions<\/li>\n<li>Borders<\/li>\n<\/ul>\n<h2 id=\"background-color\"><strong>Background Color<\/strong><\/h2>\n<p>Barcode background color can be modified through the <em>setBackColor (string $hexValue)<\/em> function of <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBaseGenerationParameters\"><em>BaseGenerationParameters<\/em><\/a> class. The default value of background color is <em>White<\/em>.<\/p>\n<p>The barcode image with background color set to <em>Color.Green<\/em> is provided below.<\/p>\n<p align=\"center\"><image src=\"colorbackground.png\"><\/p>\n<h2 id=\"bar-color\"><strong>Bar Color<\/strong><\/h2>\n<p>To manage the color of bars, the <em>setBarColor<\/em> function of <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeParameters\"><em>BarcodeParameters<\/em><\/a> class needs to be used. By default, bar color is set to <em>Black<\/em>.<\/p>\n<p>The barcode image below has been generated with the bar color setting <em>Color.Green<\/em>.<\/p>\n<p align=\"center\"><image src=\"colorbarcode.png\"><\/p>\n<h2 id=\"border-color\"><strong>Border Color<\/strong><\/h2>\n<p>Barcode border color can be adjusted through the <em>setColor (string $hexValue)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBorderParameters\"><em>BorderParameters<\/em><\/a>. The default border color is <em>Black<\/em>. The barcode image below has been generated with border color set to <em>Color.Green<\/em>.<\/p>\n<p align=\"center\"><image src=\"colorborder.png\"><\/p>\n<h2 id=\"main-text-color\"><strong>Main Text Color<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP in Java<\/strong><\/em> provides the possibility to customize the color of main text label displayed on a barcode image. It can be done by calling the <em>setColor (string $hexValue)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCodetextParameters\"><em>CodeTextParameters<\/em><\/a>. The default setting of main text color is <em>Black<\/em>. The sample barcode image shown below has been generated with the customized barcode text color setting (<em>Color.Green<\/em>).<\/p>\n<p align=\"center\"><image src=\"colorcodetext.png\"><\/p>\n<h2 id=\"caption-color\"><strong>Caption Color<\/strong><\/h2>\n<p>In <em><strong>Aspose.BarCode for PHP in Java<\/strong><\/em>, barcode images can be generated with top and bottom captions. Caption color can be customized using the <em>setTextColor (string $rgbValue)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classCaptionParameters\"><em>CaptionParameters<\/em><\/a>. Sample images below have been created with the color setting set to <em>Color.Green<\/em>.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Caption Color<\/th>\n<th style=\"text-align:center\"><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><image src=\"colorcaptionabove.png\"><\/td>\n<td style=\"text-align:center\"><image src=\"colorcaptionbelow.png\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n      "},{"title":"Phpjava: Save Generated Barcodes","link":"https:\/\/docs.aspose.com\/barcode\/phpjava\/save-barcodes\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/docs.aspose.com\/barcode\/phpjava\/save-barcodes\/","description":"\n        \n        \n        <p>This article outlines the ways of outputting generated barcode images as files, streams, or bitmaps, as well as various raster (PNG, JPEG, BMP, GIF, and TIFF) and vector (SVG and EMF) image file formats.<\/p>\n<h2 id=\"overview\"><strong>Overview<\/strong><\/h2>\n<p>During barcode generation, it may be required to save barcode images not only in common raster image formats but also as streams or vector files. <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> enables different options of saving generated barcodes: five common image formats, two vector formats, and some other ways, such as outputting barcode labels to a file, stream, or a bitmap). These options are discussed further.<\/p>\n\n\n<div class=\"alert alert-primary\" role=\"alert\">\n\n<em>If you need any clarifications, feel free to reach out <a href=\"https:\/\/docs.aspose.com\/barcode\/barcode\/phpjava\/technical-support\/\">Aspose Technical Support<\/a>: ask your questions at <a href=\"https:\/\/forum.aspose.com\/c\/barcode\/13\">Aspose.Barcode Forum<\/a> or contact <a href=\"https:\/\/helpdesk.aspose.com\/\">Aspose Paid Support Helpdesk<\/a>.<\/em>\n<\/div>\n\n<h2 id=\"saving-to-file\"><strong>Saving to File<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> enables saving generated barcode images as files in the desired format.<\/p>\n<h2 id=\"saving-to-stream\"><strong>Saving to Stream<\/strong><\/h2>\n<p>It may be necessary to output generated barcode images in the form of a stream, in other words, in a binary format. A stream can be viewed as a byte sequence abstraction. To save barcode images as streams, class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeGenerator\"><em>BarcodeGenerator<\/em><\/a> provides the public function <em>save (string $filePath, int $format)<\/em>.<\/p>\n<h2 id=\"saving-as-bitmap\"><strong>Saving as Bitmap<\/strong><\/h2>\n<p><em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> enables saving barcode images in the form of bitmap objects and then converting it to the required format or using it in graphical transformations. These objects can be fetched from instances of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeGenerator\"><em>BarcodeGenerator<\/em><\/a> using the <em>generateBarCodeImage (int $format)<\/em> function and then processed further.<\/p>\n<h2 id=\"raster-image-formats\"><strong>Raster Image Formats<\/strong><\/h2>\n<p>In <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em>, barcode images can be saved to common raster image formats, namely, PNG, GIF, BMP, JPEG, and TIFF. The value of the <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarCodeImageFormat\"><em>BarCodeImageFormat<\/em><\/a> class can be passed as the second argument to the <em>save (string $filePath, int $format)<\/em> function of class <a href=\"https:\/\/reference.aspose.com\/barcode\/php\/classBarcodeGenerator\"><em>BarcodeGenerator<\/em><\/a> to download barcode images in the specified format. The description of all supported image formats is given further.<\/p>\n<h3 id=\"bmp-format\"><strong>BMP Format<\/strong><\/h3>\n<p>BMP images are bitmap files that store bitmap digital images regardless of a graphics adapter. The BMP file format enables storing information as two-dimensional digital images in monochrome and color formats with different color depths. Using the BMP format for image generation results in producing images without compression. In this case, barcode images will have large size and 24-bit color depth. Moreover, they will not contain losses and artifacts.<\/p>\n<p>The sample BMP barcode image is given below.<\/p>\n<p align=\"center\"><image src=\"rasterimagebmp.bmp\"><\/p>\n<h3 id=\"png-format\"><strong>PNG Format<\/strong><\/h3>\n<p>Portable Network Graphics (PNG) is a raster image format that is used for lossless data compression. This format is the most preferable to generate barcode labels. Images created using this format have 32-bit color depth and no losses.<\/p>\n<p>The sample barcode image in the PNG format is provided below.<\/p>\n<p align=\"center\"><image src=\"rasterimagebmp.bmp\"><\/p>\n<h3 id=\"gif-format\"><strong>GIF Format<\/strong><\/h3>\n<p>Graphics Interchange Format (GIF) is a lossless raster file format that supports only 256 colors and enables creating both static and animated images. <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> allows using this format only for black and white raster images. The code following code snippet explains how to generate barcodes in the GIF format.<\/p>\n<p>The GIF barcode image generated using this code is shown below.<\/p>\n<p align=\"center\"><image src=\"rasterimagegif.gif\"><\/p>\n<h3 id=\"jpeg-format\"><strong>JPEG Format<\/strong><\/h3>\n<p>JPEG is a common image file format used for lossy and compressed image data. As a result of compression, generating JPEG images require finding a trade-off between  image quality and storage size and therefore often have artifacts and graphical noises. This file format is not recommended for barcode generation. The following code sample shows how to create JPEG barcode images.<\/p>\n<p>The example of a JPEG barcode image is given below.<\/p>\n<p align=\"center\"><image src=\"rasterimagejpeg.jpeg\"><\/p>\n<h3 id=\"tiff-tiffincmyk-format\"><strong>TIFF (TIFFInCMYK) Format<\/strong><\/h3>\n<p>Tagged Image File Format (TIFF) is a lossless raster image format that allows creating images of very high quality and 32-bit color. Only a variation of this format, TIFFInCMYK, supports the CMYK color scheme. The code snippet provided below explains how to generate barcode images in the TIFF format.<\/p>\n<p>TIFF and TIFFInCMYK barcode images are given below.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:center\">Output Format<\/th>\n<th style=\"text-align:center\">TIFF<\/th>\n<th style=\"text-align:center\">TIFFInCMYK<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><\/td>\n<td style=\"text-align:center\"><a href=\"rasterimagetiff.tiff\"><img src=\"rasterimagepng.png\" alttext=\"Saving to TIFF format\"><\/a><\/td>\n<td style=\"text-align:center\"><a href=\"rasterimagetiffincmyk.tiff\"><img src=\"rasterimagepng.png\" alttext=\"Saving to TIFFInCMYK format\"><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"vector-image-formats\"><strong>Vector Image Formats<\/strong><\/h2>\n<p>Vector image formats represent images as a set of graphical operations executed consequently on a graphics unit. Vector images can be generated through mathematical formulas that specify points on a grid. This format allows scaling without resolution losses. Accordingly, vector image formats may be more suitable than raster ones in some cases. <em><strong>Aspose.BarCode for PHP via Java<\/strong><\/em> supports outputting barcode images in two vector formats: EMF and SVG.<\/p>\n<h3 id=\"emf-format\"><strong>EMF Format<\/strong><\/h3>\n<p>Enhanced Metafile (EMF) is a vector image format that is device-independent and is commonly used in Windows operating systems for printing tasks. An EMF image file comprise variable-length records in chronological order. Then, a vector image can be rendered on any output device. Such records can serve to represent objects, drawing commands, and graphics parameters that are critical to render vector images. When a digital device opens an EMF metafile through its graphics environment, dimension paraneters, proportions, color scheme, and other graphics properties of the source image do not get altered on any platform.<\/p>\n<p><a href=\"vectorimageemf.emf\"> <p align=\"center\"><img src=\"rasterimagepng.png\" alttext=\"Saving to EMF format\"> <\/p><\/a><\/p>\n<h3 id=\"svg-format\"><strong>SVG Format<\/strong><\/h3>\n<p>Scalable Vector Graphics (SVG) corresponds to an vector image format based on XML. It is used to create two-dimensional images in web applications. In SVG images, the image appearance is described in XML text. Such files can be scaled to various size measures keeping resolution quality. Accordingly, this vector image format is suitable for websites and graphics printing owing to its capability to resize images in line with various design requirements.<\/p>\n<p align=\"center\"><image src=\"vectorimagesvg.svg\"><\/p>\n      "}]}}