jsmalley624
|
DataMatrix Library Issue with Postscript Font in VBScript
We purchased the 2D DataMatrix Font Developer Package, and have yet to get it to work. I need to call the postscript font using VBScript, I have looked online and read the documentation,
I am either not understanding how to do it, or not finding anything on it.
DataMatix Encoder App has been installed on a Local Machine running Windows 10 Enterprise
DLL has been registered
2D Postscript font has been installed
My last attempt had me calling the VBScript Encoder Text File that was delivered with the package, and the font is coming out
like a linear barcode, but at least I'm getting output, was never able to get output using the library which is my preferred method.
Sample PDF Attached of linear output using VB Script Text File Function.
Here is the code I used to try and call the postscript font using VB Script. Bold Text is everything related to the Encoder
'SET CONSTANT
Const ForReading = 1
Const ForAppending = 8
Const ForWriting = 2
'DECLARE VARIABLES
Dim fso, ps
Set fso = CreateObject("Scripting.FileSystemObject")
Set dmFont = CreateObject("IDAuto.Datamatrix") 'ACCESS TO THE DATA Matrix Library which is not working for me and is my preferred method of calling encoder
Set dmEncoder = fso.OpenTextFile("C:CylanceSafeprojects2DBarcodedmEncoder.vbs", ForReading) 'Ended up trying this, I at least got output. PDF file attached. Coming out linear
Execute dmEncoder.ReadAll() 'Read in entire Encoder file (VBScript Encoder.txt)
strFileName = "DMBarcode_Test.ps"
Set ps = fso.OpenTextFile("c:cylancesafeprojects2DBarcode" & strFileName, ForWriting, True)
Call PostScriptHeader()
ps.WriteLine("10 /LetterGothic-Bold font")
ps.WriteLine("4.50 inch 9.25 inch moveto")
ps.WriteLine("(SEQ001-000001) show")
ps.WriteLine ("DMBarcode") 'Postscript Font defined in Postscript Header, My definition may be why it is coming out linear, wasn't sure how to call it
ps.WriteLine("4.63 inch 10.17 inch moveto")
dmBarcode =EncNDM("001-000001") 'Calling Function in VBScript Encoder Text File
'dmBarcode = EncDM("001-000001", 0, 0, -1) 'Commented out can not get to work. Call to EncDM sub below
ps.WriteLine ("(" + dmBarcode + ") show")
ps.WriteLine ("showpage")
ps.WriteLine("")
ps.WriteLine("")
ps.Close
WScript.Echo "Complete"
'*****
'Preferred Method of Encoding DataMatrix font through library that is not working for me.
Public Function EncDM(DataToEncode, ProcTilde, EncMode, PrefFormat)
EncDM = dmFont.FontEncode(DataToEncode, ProcTilde, EncMode, PrefFormat, "DM")
End Function
'*****
Sub PostscriptHeader()
PS.WriteLine("/font {findfont exch scalefont setfont} bind def")
PS.WriteLine("/inch {72 mul} def")
PS.WriteLine("/box {exch dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath} bind def")
PS.WriteLine("/center {dup stringwidth pop 2 div neg 0 rmoveto} bind def")
PS.WriteLine("/rightshow {dup stringwidth pop 20 exch sub 0 rmoveto show} bind def")
PS.WriteLine("/wordbreak ( ) def")
PS.WriteLine("/int2of5a {/Interleaved2of5 findfont [36 0 0 12 0 0] makefont setfont} def") '******one line barcode
PS.WriteLine("/int2of5 {/Interleaved2of5 findfont [36 0 0 36 0 0] makefont setfont} def")
PS.WriteLine("/int2of5b {/Interleaved2of5 findfont [36 0 0 24 0 0] makefont setfont} def") '****two line barcode
PS.WriteLine("/imbuc23pp {/UC23PP findfont 9.12 scalefont setfont} def")
PS.WriteLine("/int2of5s {/Interleaved2of5 findfont [30 0 0 30 0 0] makefont setfont
PS.WriteLine("/int2of5bms {/Interleaved2of5 findfont [36 0 0 28 0 0] makefont setfont} def") 'Booklet Maker Barcode Small
PS.WriteLine("/DMBarcode {/IDAutomation2D findfont [12 0 0 12 0 0] makefont setfont} def") 'Defining size and name of DataMatrix Postscript font
PS.WriteLine("%%%EH")
PS.WriteLine("")
PS.WriteLine("")
Operating System:
Windows 10
Application:
VBS Edit and Adobe Acrobat Professional
Attachments:
11-13-23 1.1 year(s) ago
Report Abuse
|