Barcode.WriteFile
-----------------

Generates a barcode and writes to file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Barcode](component_Barcode.md) | [4.3](newinversion43.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Barcode.WriteFile"; Type; Path; symbology; Text { ; Width; Height; Rotation; Scale; transparent; ShowText; Encoding } ) 

**MBS**( **"Barcode.WriteFile";** /\* Generates a barcode and writes to file. \*/  
**$Type**; /\* Which file type to generate.   
Can be PNG, TIFF, JPEG, SVG or PS.e.g. "SVG" \*/   
**$Path**; /\* The file path to use.   
Currently limited to 255 characters for SVG and PS.e.g. "/tmp/test.svg" \*/   
**$symbology**; /\* The symbology to use. e.g. EANX for EAN-13.e.g. "EANX" \*/   
**$Text**; /\* The text to encode in the barcode.e.g. "12345" \*/   
**$Width**; /\* Optional; The desired width of the barcode in pixels. Zero gives the auto size.e.g. 0 \*/   
**$Height**; /\* Optional; The desired height of the barcode in pixels. Zero gives the auto size.e.g. 0 \*/   
**$Rotation**; /\* Optional; The rotation. Can be 0, 90, 180 or 270.e.g. 0 \*/   
**$Scale**; /\* Optional; The scale of the target image.  
Please use at least 4 for printing the barcode.e.g. 1.0 \*/   
**$transparent**; /\* Optional; Pass 1 to have the white background being transparent.e.g. 1 \*/   
**$ShowText**; /\* Optional; Whether to show text. Use 0 to hide text or 1 to show text.e.g. 1 \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is UTF-8.e.g. UTF8 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Type | Which file type to generate.    Can be PNG, TIFF, JPEG, SVG or PS. | "SVG" |  |
| Path | The file path to use.    Currently limited to 255 characters for SVG and PS. | "/tmp/test.svg" |  |
| symbology | The symbology to use. e.g. EANX for EAN-13. | "EANX" |  |
| Text | The text to encode in the barcode. | "12345" |  |
| Width | The desired width of the barcode in pixels. Zero gives the auto size. | 0 | Optional |
| Height | The desired height of the barcode in pixels. Zero gives the auto size. | 0 | Optional |
| Rotation | The rotation. Can be 0, 90, 180 or 270. | 0 | Optional |
| Scale | The scale of the target image.   Please use at least 4 for printing the barcode. | 1.0 | Optional |
| transparent | Pass 1 to have the white background being transparent. | 1 | Optional |
| ShowText | Whether to show text. Use 0 to hide text or 1 to show text. | 1 | Optional |
| Encoding | The text encoding for text parameter.    Default is UTF-8.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | UTF8 | Optional |

### Result

Returns OK or error.

### Description

Generates a barcode and writes to file.  
The plugin uses zint library internally, so we include the zint manual in documentation.  
  
Possible symbologies: CODE11, C25MATRIX, C25INTER, C25IATA, C25LOGIC, C25IND, CODE39, EXCODE39, EANX, EAN128, CODABAR, CODE128, DPLEIT, DPIDENT, CODE16K, CODE49, CODE93, FLAT, RSS14, RSSLTD, RSSEXP, TELEPEN, UPCA, UPCE, POSTNET, MSIPLESSEY, FIM, LOGMARS, PHARMA, PZN, PHARMA\_TWO, PDF417, PDF417TRUNC, MAXICODE, QRCODE, CODE128B, AUSPOST, AUSREPLY, AUSROUTE, AUSREDIRECT, ISBNX, RM4SCC, DATAMATRIX, EAN14, CODABLOCKF, NVE18, JAPANPOST, KOREAPOST, RSS14STACK, RSS14STACKOMNI, RSSEXPSTACK, PLANET, MICROPDF417, ONECODE, PLESSEY, TELEPEN\_NUM, ITF14, KIX, AZTEC, DAFT, MICROQR, HIBC128, HIBC39, HIBCDM, HIBCQR, HIBCPDF, HIBCMICPDF, HIBCBLOCKF, HIBCAZTEC, AZRUNE, CODE32, EANXCC, EAN128CC, RSS14CC, RSSLTDCC, RSSEXPCC, UPCACC, UPCECC, RSS14STACKCC, RSS14OMNICC, RSSEXPSTACKCC, CHANNEL, CODEONE, GRIDMATRIX, EANXCHK, UPCACHK, UPCECHK, DOTCODE, HANXIN, VIN, MAILMARK, UPNQR and ULTRA..  
  
Please use EANX for EAN-8 and EAN-13. You may need to leave away the check digit for some barcodes.  
For the size, be aware that some types like UPC codes have fixed size depending on content.  
  
See also [Barcode.SetOptions](BarcodeSetOptions.md) for further options.  
  
See [FileDialog](component_FileDialog.md) functions if you like to show a save dialog to pick a destination for the file path.  
### Examples

Creates UPCA barcode:

 MBS ( "Barcode.WriteFile"; "JPEG"; "/tmp/test.jpg"; "UPCA"; "72527270270")  
Create ISDN 9780271016368 barcode with EAN:

 MBS ( "Barcode.WriteFile"; "SVG"; "/tmp/test.svg"; "EANX"; "978027101636")  
Creates extended barcode with plus sign:

 MBS ( "Barcode.WriteFile"; "SVG"; "/tmp/test.svg"; "EANX"; "978027101636+90000")  
Write JPEG file with EAN 128

 MBS ( "Barcode.WriteFile"; "jpg"; "/tmp/test.jpg"; "EAN128"; "\[01\]98898765432106\[3202\]012345\[15\]991231")  
Creates UPCA barcode as EPS:

 MBS ( "Barcode.WriteFile"; "EPS"; "/tmp/test.eps"; "UPCA"; "72527270270")  
### See also

- [Barcode.SetOption](BarcodeSetOption.md)
- [Barcode.SetOptions](BarcodeSetOptions.md)

### Release notes

- **Version 14.5**
    - Changed [Barcode.Generate](https://www.mbsplugins.eu/BarcodeGenerate.shtml), [Barcode.GenerateJSON](https://www.mbsplugins.eu/BarcodeGenerateJSON.shtml) and [Barcode.WriteFile](https://www.mbsplugins.eu/BarcodeWriteFile.shtml) to use 4 as default scale.

### Example Databases

- [Barcode/Barcode Generation](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Barcode%20Generation.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 14.5pr3](https://www.mbsplugins.de/archive/2024-10-17/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 4.3 for OS X/Windows - More than 2700 Functions In One Plugin](https://www.mbsplugins.de/archive/2014-09-16/MBS_FileMaker_Plugin_43_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.3pr2](https://www.mbsplugins.de/archive/2014-07-15/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 27th August 2024

  
[Barcode.Version](BarcodeVersion.md) - [Barcode.ZBarVersion](BarcodeZBarVersion.md)

[HTML Version](BarcodeWriteFile.shtml)