Closed

354276 asp fpdf barcode

This project is now closed with a project budget of N/A.

Get free quotes for a project like this
Employer working
Project Budget
N/A
Project Description

Description: i have 2 issues to fix.

----------------------------------------------------

First issue is

Fpdf php class allows to produce a PDF file

on the fly from [url removed, login to view]

I use the asp version of fpdf at [url removed, login to view]

The problem is that some extensions available on the php version

are not available on Asp version no one has converted

the php extension to Asp extension

For example the php extensions you can see at

[url removed, login to view]

By clikking on "Script" from the left menu

you will see the listing of the extension available

on the php version

the first 2 rows whose titles are "bookmarks" and "rotation"

have been converted in to extentions good for the asp version of fpdf

and you can see the script converted at

Bookmark script [url removed, login to view]

Rotation script [url removed, login to view]

now what i would need for is to convert the script php extension

you can see at the bottom of the listing at

[url removed, login to view]

By clikking on "Script" from the left menu

you will see the listing of the extension available on the php version

the row whose author name is : Roland Gautier

and title is : Code 128 Barcode

i would like to have it converted in extension good for asp version

like the examples i provided above for BOOKMARK and ROTATION script

-----------------------------end of the 1st issue --------------------------------------

second issue is generating a jpeg image

Also i would like to modify the following asp that generates

a barcode image.

The problem is that it only generates a BMP image and i woul need

to generate a JPEG image.

So i would like someone ADD THE CHANCE TO GENERATE a JPEG image to the following script.

<%

OPTION EXPLICIT

' =======

' EXAMPLE

' =======

'

'

' ===============================

' REQUIRED AND OPTIONAL VARIABLES

' ===============================

'

' code = bar code value

'

' height = height of barcode in pixels.

'

' width = width MULTIPLIER in pixels.

'

' mode = type of barcode (Currently supported barcode types: code39,

' code128b, UPC-A, EAN-13, Postal, Planet)

'

' fileout = path of .bmp file to WRITE TO SERVER. Access to the

' filesystemobject is needed. Script will auto-redirect to created

' .bmp file. Relative path must be used.

'

' text = set to 'true' or '1' to display the barcode in text below the

' actual barcode.

'

' font = Font Name (there must be a font definition. ie 'CN10' or 'CN12'

' would have font definitions of 'FontCN10' and 'FontCN12'

' respectively). CN10 is the default unless changed below.

' (CN stands for Courier New)

'

' =====

' NOTES

' =====

'

' NOTE: If you prefer, you can also set the mode to 'raw' and create the

' barcode yourself by setting the code to 1s and 0s representing the

' barcode, ie: 11001100001010... In this case, 1s are black, 0s are

' white.

'

' NOTE: Maximum width & height values are 65536 pixels. Values larger than

' this will cause errors in the bmp file. This is a limitation of the

' bmp file format (why would you WANT an barcode this large anyway?)

'

' NOTE: Images generated are very small. For instance, an ean-13 barcode at a

' height of 50 pixels is a mere 662 bytes (less than 1kb). The largest

' realistic barcodes I've generated were less than 2kb.

'

' Additional code types are very easy to implement.

'

' I added support for code caching. Note that the image is NOT cached, only

' one line of the final set of 1s and 0s that represent the bars.

'

'

'

dim code, origcode, height, width, mode, text, font, fileout, caching, pushupc, FontKey, FontCN10, FontCN12, DefFont, upcspacing, code_u, code_l, IDCode

' Turn this on to cache barcodes in '10101010' format. Might speed things up

' on busy servers, although this script doesn't take many resources to begin

' with. An EAN-13 or UPC barcode will take less than 100 bytes of memory

' space. Other types will take more or less depending on the length of the

' barcode created.

Caching = True

' Turn this on to attempt to make UPC codes look like UPC codes you see on

' labels. It basicaly extends the barcode down a bit between text if text it

' turned on.

PushUPC = True

UPCSpacing = 5

' Default Font

DefFont = "CN10"

' ==============================================================

' DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING!

' ==============================================================

' ======================

' BEGIN FONT DEFINITIONS

' ======================

' Font File

' ---------

' Fonts -must- be fixed width. Note that you can still use non-fixed width

' fonts as long as you pad each character to the width of the maximum character

' width.

'

' Provided Fonts:

' ---------------

' Courier New 10px

' Courier New 12px

'

' Font File Definition

' --------------------

' chars 1-->2: character height (h) Maximum Height = 99

' chars 3-->4: character width (w) Maximum Width = 99

' chars 5-->4+w: first line of first character

' chars 5+w-->4+2w: second line of first character

' chars 5+wh-->4+wh+w: first line of second character

' etc

' CN10 = 10x7

' CN12 = 12x9

FontKey = "!""#$%&'()*+,-./0123456789:;<=>? (at) ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^abcdefghijklmnopqrstuvwxyz{|}~"

FontCN10 = "100700000000000000000100000010000001000000100000000000001000000000000000000000000000000000101000010100001010000000000000000000000000000000000000000000000101000010100011111000101000111110001010000101000000000000000000000000001000000111000100100001000000010000100100011100000100000010000000000000000000111000010100001111000111100001010000111000000000000000000000000000000000100000100000010000011110001010000011100000000000000000000000000000000100000010000001000000000000000000000000000000000000000000000000000000000100000100000010000001000000100000010000000100000000000000000000000010000000100000010000001000000100000010000010000000000000000000000000000010000111110000100000101000000000000000000000000000000000000000000000000000000100000010000111110000100000010000000000000000000000000000000000000000000000000000000000000000000001000001000000100000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000100000010000010000001000001000000100000100000010000000000000000000000000000110000100100010010001001000100100001100000000000000000000000000000000001000011100000010000001000000100001111100000000000000000000000000000001100001001000000100000100000100000111100000000000000000000000000000001110000000100001100000001000000100011100000000000000000000000000000000001000001100001010001111100000100000111000000000000000000000000000000011110001000000111000000010001001000011000000000000000000000000000000000111000100000011100001001000100100001100000000000000000000000000000000111100010010000001000001000000100000010000000000000000000000000000000001100001001000011000010010001001000011000000000000000000000000000000000110000100100010010000111000000100011100000000000000000000000000000000000000000000000100000000000000000000100000000000000000000000000000000000000000000000001000000000000000000001000001000000100000000000000000000000000000110001100011000000011000000011000000000000000000000000000000000000000000011111100000000111111000000000000000000000000000000000000000000011000000011000000011000110001100000000000000000000000000000000000110000100100000100000100000000000001000000000000000000000000000000000011000010010001011000101100010110001000000011100000000000000000000000111000001010000101000011100010001011101110000000000000000000000000000011110000100100011100001001000100100111100000000000000000000000000000000011100010010001000000100000010010000111000000000000000000000000000000111100001001000100100010010001001001111000000000000000000000000000000011111000100100011100001010000100100111110000000000000000000000000000001111100010010001110000101000010000011110000000000000000000000000000000001110001001000100000010111001001000011100000000000000000000000000000011011100100100011110001001000100100111011000000000000000000000000000001111100001000000100000010000001000011111000000000000000000000000000000001111000001000000100010010001001000111000000000000000000000000000000011101100100100010100001110000100100111011000000000000000000000000000001110000010000001000000100000010010011111000000000000000000000000000000110011001001000111100010010001001001110110000000000000000000000000000011011100110100011010001011000101100111010000000000000000000000000000000011000010010001001000100100010010000110000000000000000000000000000000111100001001000100100011100001000001110000000000000000000000000000000000110000100100010010001001000100100001100000111000000000000000000000001111000010010001001000111000010100011101100000000000000000000000000000001110001001000010000000100001001000111000000000000000000000000000000011111001010100001000000100000010000011100000000000000000000000000000001110110010010001001000100100010010000110000000000000000000000000000000110111001001000100100010010000110000011000000000000000000000000000000111011101010100101010010101000101000010100000000000000000000000000000001101110010010000110000011000010010011101100000000000000000000000000000110111001001000011000001000000100000111000000000000000000000000000000001111000100100010100000101000100100011110000000000000000000000000000000011100001000000100000010000001000000100000011100000000000000000000100000010000010000001000001000000100000100000010000000000000000000000000001110000001000000100000010000001000000100001110000000000000000000100000101000010100010001000000000000000000000000000000000000000000000000000000000000000000111000001110001001000111110000000000000000000000000000011000000100000011100001001000100100111100000000000000000000000000000000000000000000000111000100100010000000111000000000000000000000000000000000110000001000011100010010001001000011110000000000000000000000000000000000000000000001100001111000100000001110000000000000000000000000000000001110001000001111000010000001000001111000000000000000000000000000000000000000000000011110010010001001000011100000010000110000000000000000011000000100000011100001001000100100111011000000000000000000000000000000010000000000011100000010000001000011111000000000000000000000000000000000100000000000111100000010000001000000100000010001110000000000000000011000000100000010110001100000101000110110000000000000000000000000000001110000001000000100000010000001000011111000000000000000000000000000000000000000000011111000101010010101011010110000000000000000000000000000000000000000000111100001001000100100111011000000000000000000000000000000000000000000000110000100100010010000110000000000000000000000000000000000000000000001111000010010001001000111000010000011100000000000000000000000000000000001111001001000100100001110000001000001110000000000000000000000000000001101100011000001000001111000000000000000000000000000000000000000000000011100011000000011000111000000000000000000000000000000000100000010000011110000100000010000000110000000000000000000000000000000000000000000011011000100100010010000111100000000000000000000000000000000000000000001100110010010001001000011000000000000000000000000000000000000000000000111011001010100010100001010000000000000000000000000000000000000000000011011000101000011100011011000000000000000000000000000000000000000000001110110010010000110000010000001000011110000000000000000000000000000000011110001010000010100011110000000000000000000000000000000011000001000000100000100000001000000100000011000000000000000000000000001000000100000010000001000000100000010000001000000000000000000000000001100000010000001000000010000010000001000001100000000000000000000000000000000000000001101001011000000000000000000000000000000"

FontCN12 = "1209000000000000000000000110000000110000000110000000110000000110000000110000000000000000110000000000000000000000000000000000000000001010000001010000001010000001010000000000000000000000000000000000000000000000000000000000000000000000000000001101100001101100001101100011111110001101100011111110001101100001101100001101100000000000000000000000010000000111100001100100001100000001111000000011100000001100001001100001111000000010000000010000000000000000000000001100000010010000010010100001111000000111100001010010000010010000001100000000000000000000000000000000000000000111000001100000001100000001100000011101100010111000010011000001111100000000000000000000000000000000000000000010000000010000000010000000010000000000000000000000000000000000000000000000000000000000000000000000000000000001000000011000000010000000110000000110000000110000000110000000010000000011000000001000000000000000000000001000000001100000000100000000110000000110000000110000000110000000100000001100000001000000000000000000000000000110000000110000011111100001111000001111000001001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000010000001111100000010000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000010000000110000000100000000000000000000000000000000000000000000000000000000000001111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000110000000000000000000000000000000000000000000001100000001100000011000000011000000111000000110000000110000001100000001100000000000000000000000000000000000111000001101100001101100001101100001101100001101100001101100000111000000000000000000000000000000000000000000011000001111000000011000000011000000011000000011000000011000001111110000000000000000000000000000000000000000111000001101100001101100000001100000011000000110000001100000001111100000000000000000000000000000000000000000111000001001100000001100000111000000001100000001100001001100000111000000000000000000000000000000000000000000011000000111000001011000001011000010011000011111100000011000000111100000000000000000000000000000000000000001111100001100000001111000001001100000001100000001100001001100000111000000000000000000000000000000000000000000011100000110000001100000001111000001101100001101100001101100000111000000000000000000000000000000000000000001111100001001100000001100000001100000011000000011000000011000000011000000000000000000000000000000000000000000111000001101100001101100000111000001101100001101100001101100000111000000000000000000000000000000000000000000111000001101100001101100001101100000111100000001100000011000001110000000000000000000000000000000000000000000000000000000000000110000000110000000000000000000000000110000000110000000000000000000000000000000000000000000000000000000000000110000000110000000000000000000000000110000000100000000100000000000000000000000000000000000000000000000110000001000000110000011000000000110000000001000000000110000000000000000000000000000000000000000000000000000000000000000011111110000000000011111110000000000000000000000000000000000000000000000000000000000000000011000000000100000000011000000000110000011000000100000011000000000000000000000000000000000000000000000111000001101100000001100000011100000111000000110000000000000000110000000000000000000000000000000000000000000111000001000100010011100010100100010100100010011100010000000001000100000111000000000000000000000000000000011111000000111000000101000001101100001101100001111100001101100011101110000000000000000000000000000000000000111111000011001100011001100011111000011001100011001100011001100111111000000000000000000000000000000000000000000111100001100100011000100011000000011000000011000000001100100000111000000000000000000000000000000000000000111110000011011000011001100011001100011001100011001100011011000111110000000000000000000000000000000000000000111111100011000100011010100011110000011010000011000100011000100111111100000000000000000000000000000000000000111111100011000100011010100011110000011010000011000000011000000111110000000000000000000000000000000000000000001111100011000100011000000011000000011011110011001100011001100001111000000000000000000000000000000000000000111001110011001100011001100011111100011001100011001100011001100111001110000000000000000000000000000000000000011111100000110000000110000000110000000110000000110000000110000011111100000000000000000000000000000000000000000111110000001100000001100000001100011001100011001100011001100011111000000000000000000000000000000000000000111101110011001100011011000011110000011111000011001100011001100111100110000000000000000000000000000000000000111100000011000000011000000011000000011000000011000100011000100111111100000000000000000000000000000000000000111000110011101100011101100011101100011010100011010100011000100111101110000000000000000000000000000000000000111011110011001100011101100011101100011011100011011100011001100111101100000000000000000000000000000000000000001111000011001100011001100011001100011001100011001100011001100001111000000000000000000000000000000000000000011111000001101100001101100001101100001111000001100000001100000011110000000000000000000000000000000000000000001111000011001100011001100011001100011001100011001100011001100001111000000111100000000000000000000000000000111111000011001100011001100011001100011111000011011000011001100111100110000000000000000000000000000000000000001111100011000100011000000001110000000111000000001100010001100011111000000000000000000000000000000000000000011111100010110100010110100000110000000110000000110000000110000001111000000000000000000000000000000000000000111001110011001100011001100011001100011001100011001100011001100001111000000000000000000000000000000000000000111001110011001100011001100001001000001001000001111000000110000000110000000000000000000000000000000000000000111101111011000110011010110001010100001101100001101100001101100001101100000000000000000000000000000000000000111001110011001100001111000000110000000110000001111000011001100111001110000000000000000000000000000000000000111001110011001100001001000001111000000110000000110000000110000011111100000000000000000000000000000000000000011111100010001100010011000000110000000110000001100100011000100011111100000000000000000000000000000000000000000111100000110000000110000000110000000110000000110000000110000000110000000110000000111100000000000000000000000001100000001100000011000000011000000111000000110000000110000001100000001100000000000000000000000000000000011110000000110000000110000000110000000110000000110000000110000000110000000110000011110000000000000000000000000010000000101000000101000001000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111000000001100001111100011001100011001100001111110000000000000000000000000000000000000111000000011000000011011000011101100011001100011001100011101100111011000000000000000000000000000000000000000000000000000000000001111100011000100011000000011000000011000100001111000000000000000000000000000000000000000000011100000001100001101100011011100011001100011001100011011100001101110000000000000000000000000000000000000000000000000000000001111000011001100011111100011000000011000100001111000000000000000000000000000000000000000000011100000110000001111100000110000000110000000110000000110000001111100000000000000000000000000000000000000000000000000000000001101110011011100011001100011001100011011100001101100000001100001111000000000000000000000011100000001100000001111000001101100001101100001101100001101100011101110000000000000000000000000000000000000000110000000000000011110000000110000000110000000110000000110000011111100000000000000000000000000000000000000000110000000000000011111000000011000000011000000011000000011000000011000000011000011110000000000000000000000011100000001100000001101100001111000001110000001111000001101100011100110000000000000000000000000000000000000011110000000110000000110000000110000000110000000110000000110000011111100000000000000000000000000000000000000000000000000000000111111100011010110011010110011010110011010110111010111000000000000000000000000000000000000000000000000000000011111000001101100001101100001101100001101100011101110000000000000000000000000000000000000000000000000000000001111000011001100011001100011001100011001100001111000000000000000000000000000000000000000000000000000000000111011000011101100011001100011001100011101100011011000011000000111110000000000000000000000000000000000000000001101110011011100011001100011001100011011100001101100000001100000111110000000000000000000000000000000000000011101100001110100001100000001100000001100000011111000000000000000000000000000000000000000000000000000000000001111100011001100011110000000111100011001100011111000000000000000000000000000000000000000001100000001100000011111000001100000001100000001100000001100100000111000000000000000000000000000000000000000000000000000000000011101100001101100001101100001101100001101100000111110000000000000000000000000000000000000000000000000000000011101110001101100001101100000101000000111000000111000000000000000000000000000000000000000000000000000000000111101111011010110011010110001101100001101100001101100000000000000000000000000000000000000000000000000000000011101110001101100000111000000111000001101100011101110000000000000000000000000000000000000000000000000000000011101110001101100001101100000111000000111000000110000000110000011111000000000000000000000000000000000000000001111100001001100000011000000110000001100100001111100000000000000000000000000000000000000000011000000110000000110000000110000000110000001100000000110000000110000000110000000011000000000000000000000000110000000110000000110000000110000000110000000110000000110000000110000000110000000110000000000000000000000001100000000110000000110000000110000000110000000011000000110000000110000000110000001100000000000000000000000000000000000000000000000000000100000001010100000001000000000000000000000000000000000000000"

' ====================

' END FONT DEFINITIONS

' ====================

caching = false

code = "ABC1234567890" '[url removed, login to view]("code")

height = 40 '[url removed, login to view]("height")

width = 60 ' [url removed, login to view]("width")

mode = "code128b" '[url removed, login to view]("mode")

fileout = "/public/[url removed, login to view]" '[url removed, login to view]("fileout")

text = true 'cbool([url removed, login to view]("text"))

font = "FontCN12" '[url removed, login to view]("font")

IDCode = [url removed, login to view]("IDCode")

if font = "" OR eval("Font" & font) = "" then font = defFont

If IDCode = "" Then IDCode = "47"

if not IsNumeric(height) or height = "" then height = 1 else height = numeric(height)

if not IsNumeric(width) or width = "" then width = 1 else width = numeric(width)

if width > 1 then pushupc = false

if pushupc and lcase(mode) = "upc-a" then code = left(code, 1) & " " & mid(code, 2, 5) & " " & mid(code, 7, 5) & " " & right(code, 1)

origcode = code

if caching AND application("cache" & origcode & mode & height & width & IDCode) <> "" then

code = application("cache" & origcode & mode & height & width & IDCode)

code_u = application("cache_u" & origcode & mode & height & width & IDCode)

code_l = application("cache_l" & origcode & mode & height & width & IDCode)

else

select case lcase(mode)

case "raw" ' do nothing. non-0 chars are automatically 1s

case "code39": code = code39(code)

case "code128b": code = code128b(code)

case "upc-a": code = codeean13("0" & code, "AAAAAA")

case "ean-13": code = codeean13(code, eanflag(left(code, 1)))

Case "postnet"

code = PostChecksum(code)

code_U = Postnet_U(code)

code_L = Postnet_L(code)

Case "planet"

code = PostChecksum(IDCode & code)

code_U = Planet_U(code)

code_L = Planet_L(code)

end select

if caching then

[url removed, login to view]

Application("cache" & origcode & mode & height & width & IDCode) = code

Application("cache_u" & origcode & mode & height & width & IDCode) = code_u

Application("cache_l" & origcode & mode & height & width & IDCode) = code_l

[url removed, login to view]

end if

end if

' ================================

' BEGIN RANDOM NECESSARY FUNCTIONS

' ================================

Function stb(String)

Dim I, B

For I=1 to len(String)

B = B & ChrB(Asc(Mid(String,I,1)))

Next

stb = B

End Function

function tstr(data, width)

dim tchar, total, tpos, i, j, x

tchar = 0

total = ""

tpos = 8

for i = 1 to len(data)

for j = 1 to width

tpos = tpos - 1

if mid(data, i, 1) <> "0" then tchar = tchar + 2^tpos

if tpos = 0 then

total = total & chr(tchar)

tpos = 8

tchar = 0

end if

next

next

if tpos <> 8 then

total = total & chr(tchar)

end if

x = len(total) mod 4

if x = 0 then x = 4

for i = x to 3

total = total & chr(0)

next

tstr = total

end function

function numeric(byval num)

dim numb, valid, i

numb = ""

valid = "0123456789"

for i = 1 to len(num)

if InStr(valid, mid(num, i, 1)) > 0 then numb = numb & mid(num, i, 1)

next

num = left(num, 30)

numeric = cint(num)

end function

function size(byval lngth)

lngth = cdbl(lngth)

if lngth > 255 then

if lngth > 65535 then lngth = 65535

size = chr(lngth mod 256) & chr(int(lngth/256))

else

size = chr(lngth) & chr(0)

end if

end function

function gWidth()

dim fLen

if text then

fLen = cint(mid(eval("font" & font), 3, 2))

if (fLen*len(origcode)) > (len(cIf(instr("postnet:planet", lcase(mode))>0, code_l, code))*width) then gWidth = (fLen*len(origcode)) else gWidth = len(cIf(instr("postnet:planet", lcase(mode))>0, code_l, code))*width

if lcase(mode) = "upc-a" and pushupc then

gWidth = gWidth - (fLen*5)+(UPCSpacing*5)

end if

else

gWidth = len(cIf(instr("postnet:planet", lcase(mode))>0, code_l, code))*width

end if

end function

function Pad(byval code, byval length)

pad = replace(space(int((length-len(code))/2)), " ", "0") & code & replace(space(int(((length-len(code))/2)+.999)), " ", "0")

end function

function cIf(a, b, c)

if a then cIf = b else cIf = c

end function

' ==============================

' END RANDOM NECESSARY FUNCTIONS

' ==============================

' =================================

' BEGIN BARCODE ALGORITHM FUNCTIONS

' =================================

function code39(byval code)

dim output, i, clet

output = ""

code = "*" & replace(code, "*", "") & "*"

for i = 1 to len(code)

clet = ""

select case ucase(mid(code, i, 1))

case "1": clet = "111010001010111"

case "2": clet = "101110001010111"

case "3": clet = "111011100010101"

case "4": clet = "101000111010111"

case "5": clet = "111010001110101"

case "6": clet = "101110001110101"

case "7": clet = "101000101110111"

case "8": clet = "111010001011101"

case "9": clet = "101110001011101"

case "0": clet = "101000111011101"

case "A": clet = "111010100010111"

case "B": clet = "101110100010111"

case "C": clet = "111011101000101"

case "D": clet = "101011100010111"

case "E": clet = "111010111000101"

case "F": clet = "101110111000101"

case "G": clet = "101010001110111"

case "H": clet = "111010100011101"

case "I": clet = "101110100011101"

case "J": clet = "101011100011101"

case "K": clet = "111010101000111"

case "L": clet = "101110101000111"

case "M": clet = "111011101010001"

case "N": clet = "101011101000111"

case "O": clet = "111010111010001"

case "P": clet = "101110111010001"

case "Q": clet = "101010111000111"

case "R": clet = "111010101110001"

case "S": clet = "101110101110001"

case "T": clet = "101011101110001"

case "U": clet = "111000101010111"

case "V": clet = "100011101010111"

case "W": clet = "111000111010101"

case "X": clet = "100010111010111"

case "Y": clet = "111000101110101"

case "Z": clet = "100011101110101"

case "-": clet = "100010101110111"

case ".": clet = "111000101011101"

case " ": clet = "100011101011101"

case "*": clet = "100010111011101"

case "$": clet = "100010001000101"

case "/": clet = "100010001010001"

case "+": clet = "100010100010001"

case "%": clet = "101000100010001"

end select

output = output & clet & "0"

next

code39 = left(output, len(output)-1)

end function

Function code128b(ByVal InputString)

Const MinValidAscii = 32

Const MaxValidAscii = 126

Dim CharValue(255)

Dim i

for i = 0 to 94

CharValue(i+32) = i

next

for i = 95 to 106

CharValue(i+100) = i

next

' Encode the input string

InputString = Trim(InputString)

Dim CheckDigitValue, CharPos, CharAscii, InvalidCharsFound

InvalidCharsFound = false

CheckDigitValue = CharValue(204)

For CharPos = 1 To Len(InputString)

CharAscii = Asc(Mid(InputString, CharPos, 1))

if (CharAscii < MinValidAscii) OR (CharAscii > MaxValidAscii) then

CharAscii = Asc("?")

InvalidCharsFound = true

end if

CheckDigitValue = CheckDigitValue + (CharValue(CharAscii) * CharPos)

Next

CheckDigitValue = (CheckDigitValue Mod 103)

Dim CheckDigitAscii

if CheckDigitValue < 95 then

CheckDigitAscii = CheckDigitValue + 32

else

CheckDigitAscii = CheckDigitValue + 100

end if

Dim OutputString

OutputString = Chr(204) & InputString & Chr(CheckDigitAscii) & Chr(206)

Dim BarcodePattern(255)

BarcodePattern(32) = "212222" ' <SPACE>

BarcodePattern(33) = "222122" ' !

BarcodePattern(34) = "222221" ' "

BarcodePattern(35) = "121223" ' #

BarcodePattern(36) = "121322" ' $

BarcodePattern(37) = "131222" ' %

BarcodePattern(38) = "122213" ' &

BarcodePattern(39) = "122312" ' '

BarcodePattern(40) = "132212" ' (

BarcodePattern(41) = "221213" ' )

BarcodePattern(42) = "221312" ' *

BarcodePattern(43) = "231212" ' +

BarcodePattern(44) = "112232" ' ,

BarcodePattern(45) = "122132" ' -

BarcodePattern(46) = "122231" ' .

BarcodePattern(47) = "113222" ' /

BarcodePattern(48) = "123122" ' 0

BarcodePattern(49) = "123221" ' 1

BarcodePattern(50) = "223211" ' 2

BarcodePattern(51) = "221132" ' 3

BarcodePattern(52) = "221231" ' 4

BarcodePattern(53) = "213212" ' 5

BarcodePattern(54) = "223112" ' 6

BarcodePattern(55) = "312131" ' 7

BarcodePattern(56) = "311222" ' 8

BarcodePattern(57) = "321122" ' 9

BarcodePattern(58) = "321221" ' :

BarcodePattern(59) = "312212" ' ;

BarcodePattern(60) = "322112" ' <

BarcodePattern(61) = "322211" ' =

BarcodePattern(62) = "212123" ' >

BarcodePattern(63) = "212321" ' ?

BarcodePattern(64) = "232121" '

BarcodePattern(65) = "111323" ' A

BarcodePattern(66) = "131123" ' B

BarcodePattern(67) = "131321" ' C

BarcodePattern(68) = "112313" ' D

BarcodePattern(69) = "132113" ' E

BarcodePattern(70) = "132311" ' F

BarcodePattern(71) = "211313" ' G

BarcodePattern(72) = "231113" ' H

BarcodePattern(73) = "231311" ' I

BarcodePattern(74) = "112133" ' J

BarcodePattern(75) = "112331" ' K

BarcodePattern(76) = "132131" ' L

BarcodePattern(77) = "113123" ' M

BarcodePattern(78) = "113321" ' N

BarcodePattern(79) = "133121" ' O

BarcodePattern(80) = "313121" ' P

BarcodePattern(81) = "211331" ' Q

BarcodePattern(82) = "231131" ' R

BarcodePattern(83) = "213113" ' S

BarcodePattern(84) = "213311" ' T

BarcodePattern(85) = "213131" ' U

BarcodePattern(86) = "311123" ' V

BarcodePattern(87) = "311321" ' W

BarcodePattern(88) = "331121" ' X

BarcodePattern(89) = "312113" ' Y

BarcodePattern(90) = "312311" ' Z

BarcodePattern(91) = "332111" ' [

BarcodePattern(92) = "314111" ' /

BarcodePattern(93) = "221411" ' ]

BarcodePattern(94) = "431111" ' ^

BarcodePattern(95) = "111224" ' _

BarcodePattern(96) = "111422" ' `

BarcodePattern(97) = "121124" ' a

BarcodePattern(98) = "121421" ' b

BarcodePattern(99) = "141122" ' c

BarcodePattern(100) = "141221" ' d

BarcodePattern(101) = "112214" ' e

BarcodePattern(102) = "112412" ' f

BarcodePattern(103) = "122114" ' g

BarcodePattern(104) = "122411" ' h

BarcodePattern(105) = "142112" ' i

BarcodePattern(106) = "142211" ' j

BarcodePattern(107) = "241211" ' k

BarcodePattern(108) = "221114" ' l

BarcodePattern(109) = "413111" ' m

BarcodePattern(110) = "241112" ' n

BarcodePattern(111) = "134111" ' o

BarcodePattern(112) = "111242" ' p

BarcodePattern(113) = "121142" ' q

BarcodePattern(114) = "121241" ' r

BarcodePattern(115) = "114212" ' s

BarcodePattern(116) = "124112" ' t

BarcodePattern(117) = "124211" ' u

BarcodePattern(118) = "411212" ' v

BarcodePattern(119) = "421112" ' w

BarcodePattern(120) = "421211" ' x

BarcodePattern(121) = "212141" ' y

BarcodePattern(122) = "214121" ' z

BarcodePattern(123) = "412121" ' {

BarcodePattern(124) = "111143" ' |

BarcodePattern(125) = "111341" ' }

BarcodePattern(126) = "131141" ' ~

BarcodePattern(195) = "114113"

BarcodePattern(196) = "114311"

BarcodePattern(197) = "411113"

BarcodePattern(198) = "411311"

BarcodePattern(199) = "113141"

BarcodePattern(200) = "114131"

BarcodePattern(201) = "311141"

BarcodePattern(202) = "411131"

BarcodePattern(203) = "211412"

BarcodePattern(204) = "211214"

BarcodePattern(205) = "211232"

BarcodePattern(206) = "2331112"

Dim OutputPattern, ThisPattern, thischar

OutputPattern = ""

for CharPos = 1 to Len(OutputString)

ThisPattern = BarcodePattern(Asc(Mid(OutputString, CharPos, 1)))

for i = 1 to len(ThisPattern)

if i mod 2 = 1 then thischar = "1" else thischar = "0"

OutputPattern = OutputPattern & replace(space(int(mid(ThisPattern, i, 1))), " ", thischar)

next

next

code128b = OutputPattern

End Function

Function CodeEAN13(byval code, encoding)

Dim leftA, leftB, rght, OutputPattern, i, tcode

for i = 1 to len(code)

if instr("0123456789", mid(code, i, 1))>0 then tcode = tcode & mid(code, i, 1)

next

code = tcode

if len(code) = 13 then

LeftA = Array("0001101", "0011001", "0010011", "0111101", "0100011", "0110001", "0101111", "0111011", "0110111", "0001011")

LeftB = Array("0100111", "0110011", "0011011", "0100001", "0011101", "0111001", "0000101", "0010001", "0001001", "0010111")

Rght = Array("1110010", "1100110", "1101100", "1000010", "1011100", "1001110", "1010000", "1000100", "1001000", "1110100")

OutputPattern = "101"

for i = 1 to 6

if mid(ucase(encoding), i, 1) = "A" then

OutputPattern = OutputPattern & LeftA(cint(mid(code, i+1, 1)))

else

OutputPattern = OutputPattern & LeftB(cint(mid(code, i+1, 1)))

end if

next

OutputPattern = OutputPattern & "01010"

for i = 1 to 6

OutputPattern = OutputPattern & Rght(cint(mid(code, i+7, 1)))

next

OutputPattern = OutputPattern & "101"

CodeEAN13 = OutputPattern

end if

End Function

Function eanflag(num)

select case num

case 0: eanflag = "AAAAAA"

case 1: eanflag = "AABABB"

case 2: eanflag = "AABBAB"

case 3: eanflag = "AABBBA"

case 4: eanflag = "ABAABB"

case 5: eanflag = "ABBAAB"

case 6: eanflag = "ABBBAA"

case 7: eanflag = "ABABAB"

case 8: eanflag = "ABABBA"

case 9: eanflag = "ABBABA"

end select

End Function

Function PostChecksum(code)

Dim intTotal, intCounter

intTotal = 0

For intCounter = 1 To Len(code)

intTotal = intTotal + CInt(Mid(code, intCounter, 1))

Next

PostChecksum = code & CStr(Fix((intTotal + 9)/10)*10 - intTotal)

End Function

Function Postnet_U(code)

Dim Output_U, intCounter, Pattern_U

Output_U = "99000"

For intCounter = 1 To Len(code)

Pattern_U = ""

Select Case UCase(Mid(code, intCounter, 1))

Case "0": Pattern_U = "9900099000000000000000"

Case "1": Pattern_U = "0000000000000009900099"

Case "2": Pattern_U = "0000000000990000000099"

Case "3": Pattern_U = "0000000000990009900000"

Case "4": Pattern_U = "0000099000000000000099"

Case "5": Pattern_U = "0000099000000009900000"

Case "6": Pattern_U = "0000099000990000000000"

Case "7": Pattern_U = "9900000000000000000099"

Case "8": Pattern_U = "9900000000000009900000"

Case "9": Pattern_U = "9900000000990000000000"

End Select

Output_U = Output_U & Pattern_U & "000"

Next

Output_U = Output_U & "99"

Postnet_U = Left(Output_U, Len(Output_U))

End Function

Function Postnet_L(code)

Dim Output_L, intCounter, Pattern_L

Pattern_L = "9900099000990009900099"

Output_L = "99000"

For intCounter = 1 To Len(code)

Output_L = Output_L & Pattern_L & "000"

Next

Output_L = Output_L & "99"

Postnet_L = Left(Output_L, Len(Output_L))

End Function

Function Planet_U(code)

Dim Output_U, intCounter, Pattern_U

Output_U = "99000"

For intCounter = 1 To Len(code)

Pattern_U = ""

Select Case UCase(Mid(code, intCounter, 1))

Case "0": Pattern_U = "0000000000990009900099"

Case "1": Pattern_U = "9900099000990000000000"

Case "2": Pattern_U = "9900099000000009900000"

Case "3": Pattern_U = "9900099000000000000099"

Case "4": Pattern_U = "9900000000990009900000"

Case "5": Pattern_U = "9900000000990000000099"

Case "6": Pattern_U = "9900000000000009900099"

Case "7": Pattern_U = "0000099000990009900000"

Case "8": Pattern_U = "0000099000990000000099"

Case "9": Pattern_U = "0000099000000009900099"

End Select

Output_U = Output_U & Pattern_U & "000"

Next

Output_U = Output_U & "99"

Planet_U = Left(Output_U, Len(Output_U))

End Function

Function Planet_L(code)

Dim Output_L, intCounter, Pattern_L

Pattern_L = "9900099000990009900099"

Output_L = "99000"

For intCounter = 1 To Len(code)

Output_L = Output_L & Pattern_L & "000"

Next

Output_L = Output_L & "99"

Planet_L = Left(Output_L, Len(Output_L))

End Function

' ===============================

' END BARCODE ALGORITHM FUNCTIONS

' ===============================

' ===========================

' BEGIN WRITE OUT THE BARCODE

' ===========================

dim dataout, i, j, datawrite, FSO, File, bcwidth, height2, ffile, fheight, fwidth, tmp

if code <> "" then

bcwidth = gWidth()

if bcWidth > (len(code)*width) then code = Pad(code, bcWidth)

dataout = tstr(cIf(instr("postnet:planet", lcase(mode))>0, code_l, code), width)

if text then height2 = cint(mid(eval("font" & font), 1, 2)) else height2 = 0

height2 = height2 + height

datawrite = (chr(66) & chr(77) & size(62+(len(dataout)*height2)) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(62) & chr(0) & chr(0) & chr(0) & chr(40) & chr(0) & chr(0) & chr(0) & size(bcwidth) & chr(0) & chr(0) & size(height2) & chr(0) & chr(0) & chr(1) & chr(0) & chr(1) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(37) & chr(14) & chr(0) & chr(0) & chr(37) & chr(14) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(255) & chr(255) & chr(255) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0))

if text then

ffile = eval("font" & font)

fheight = cint(mid(eval("font" & font), 1, 2))

fwidth = cint(mid(eval("font" & font), 3, 2))

for i = fheight to 1 step -1

tmp = ""

for j = 1 to len(origcode)

if mid(origcode, j, 1) = " " then

if lcase(mode) = "upc-a" and i<=5 and pushupc then

tmp = tmp & mid(code, len(tmp)+1, UPCSpacing)

elseif lcase(mode) = "upc-a" and pushupc then

tmp = tmp & replace(space(UPCSpacing), " ", "0")

else

tmp = tmp & replace(space(fwidth), " ", "0")

end if

else

tmp = tmp & mid(ffile, (instr(FontKey, mid(origcode, j, 1))-1)*(fheight*fwidth)+((i-1)*fwidth)+5, fwidth)

end if

next

datawrite = datawrite & tstr(pad(tmp, bcwidth), 1)

next

end if

for i = 1 to cIf(instr("postnet:planet", lcase(mode))>0, int(height/2), height)

datawrite = datawrite & dataout

next

if instr("postnet:planet", lcase(mode))>0 then

dataout = tstr(code_U, width)

For i = 1 To int(height/2)

datawrite = datawrite & dataout

Next

end if

end if

'----------------------------crea file

fileout=""

if fileout <> "" then

fileout = "/public/[url removed, login to view]"

set FSO = [url removed, login to view]("[url removed, login to view]")

set File = [url removed, login to view]([url removed, login to view](fileout), true)

[url removed, login to view] (datawrite)

set File = nothing

set FSO = nothing

[url removed, login to view] fileout

else

[url removed, login to view] = "image/bmp"

[url removed, login to view] stb(datawrite)

end if

' =========================

' END WRITE OUT THE BARCODE

' =========================

%>

Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online