ByteScout Barcode Suite - Visual Basic 6 - Set barcode size with barcode sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Barcode Suite – Visual Basic 6 – Set barcode size with barcode sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – Visual Basic 6 – Set barcode size with barcode sdk

How to set barcode size with barcode sdk in Visual Basic 6 and ByteScout Barcode Suite

Learning is essential in computer world and the tutorial below will demonstrate how to set barcode size with barcode sdk in Visual Basic 6

On this page you will learn from code samples for programming in Visual Basic 6.Writing of the code to set barcode size with barcode sdk in Visual Basic 6 can be executed by programmers of any level using ByteScout Barcode Suite. ByteScout Barcode Suite is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK). It can be applied to set barcode size with barcode sdk using Visual Basic 6.

Want to save time? You will save a lot of time on writing and testing code as you may just take the Visual Basic 6 code from ByteScout Barcode Suite for set barcode size with barcode sdk below and use it in your application. Just copy and paste the code into your Visual Basic 6 application’s code and follow the instructions. Complete and detailed tutorials and documentation are available along with installed ByteScout Barcode Suite if you’d like to learn more about the topic and the details of the API.

You can download free trial version of ByteScout Barcode Suite from our website with this and other source code samples for Visual Basic 6.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Form1.frm
      
VERSION 5.00 Begin VB.Form Form1 AutoRedraw = -1 'True Caption = "Form1" ClientHeight = 4845 ClientLeft = 45 ClientTop = 435 ClientWidth = 9795 LinkTopic = "Form1" ScaleHeight = 4845 ScaleWidth = 9795 StartUpPosition = 3 'Windows Default End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Form_Load() ' this method prints a barcode via temporary EMF metafile allowing to set target physical size and DPI resolution quality Const DPIQuality = 300 ' 300 DPI as printing resolution (DPI) quality Const WidthInInches = 4 ' 4 inches as width for the barcode generated Const HeightInInches = 1 ' 1 inches as height for the barcode generated ' create barcode object as ActiveX Dim BC Set BC = CreateObject("Bytescout.BarCode.Barcode") Printer.PrintQuality = DPIQuality ' set the printer quality to 300 dpi ' IMPORTANT: call Printer.Print Space(1) to initialize the Printer ' this is how Microsoft advises to do in their KB article (search for Printer.Print string): http://support.microsoft.com/kb/146022 Printer.Print Space(1) ' initialize hDC of Printer object ' set the same DPI resolution (300 DPI) to generate barcode image BC.ResolutionX = DPIQuality BC.ResolutionY = DPIQuality ' set barcode symbology type BC.Symbology = 0 ' Code 39 = 0 (see the documentation for other barcode types) ' set barcode value BC.Value = "1234567890" ' use .FitInto_3 method to set the size in inches (you can also set in mm, cm, pixels - see the documentation for more) BC.FitInto_3 WidthInInches, HeightInInches, 2 ' fit into 3.5x0.875 inches (2 = inch) ' save barcode into temprorary EMF image ' create FileSystemObject to work with files Dim FSO As Object Set FSO = CreateObject("Scripting.filesystemobject") ' get temporary filename to save a temporary .EMF file Dim tempEMFFileName tempEMFFileName = FSO.GetTempName() & ".EMF" ' save EMF metafile into the temporary file BC.SaveImage tempEMFFileName ' now we paint EMF file to Printer object ' default units for Printer in VB6 is Twips, which is 1440 per Inch ' so we calculate 3.5 inches as 3.5 * TwipsPerInch Const TwipsPerInch = 1440 ' now printing the picture at 0,0 with 3.5 inches X 0.875 inches Printer.PaintPicture LoadPicture(tempEMFFileName), 0, 200, 3.5 * TwipsPerInch, 0.875 * TwipsPerInch ' now remove temporary EMF file FSO.deletefile tempEMFFileName, True Set FSO = Nothing ' finally send command to print the page Printer.EndDoc Set BC = Nothing End Sub

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Project1.vbp
      
Type=Exe Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation Form=Form1.frm Startup="Form1" ExeName32="Project1.exe" Command32="" Name="Project1" HelpContextID="0" CompatibleMode="0" MajorVer=1 MinorVer=0 RevisionVer=0 AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="000" CompilationType=0 OptimizationType=0 FavorPentiumPro(tm)=0 CodeViewDebugInfo=0 NoAliasing=0 BoundsCheck=0 OverflowCheck=0 FlPointCheck=0 FDIVCheck=0 UnroundedFP=0 StartMode=0 Unattended=0 Retained=0 ThreadPerObject=0 MaxNumberOfThreads=1 [MS Transaction Server] AutoRefresh=1

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next