Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2010
    Posts
    5
    Rep Power
    0

    Default Encoding a magnetic stripe

    Hi
    Is there anybody that knows anything about encoding a magnetic stripe with a card printer? I am doing a study project in computer science and I cant find any Java example code anywhere, on how to tell the printer to encode the magnetic stripe. Can anybody help me?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Does the printer come with any documentation?
    How does it connect to the computer running your Java code?

  3. #3
    Join Date
    Nov 2010
    Posts
    5
    Rep Power
    0

    Default Fargo DTC 550

    The only documentation that Fargo provides is a user guide http://www.fargo.com/users_guides_pd...e_Rev._2.8.pdf . I have asked their support for an API, but got this answer:
    ----------------
    You dont need the API for magstripe encoding if you send the Mag data with

    ~1
    ~2
    ~3

    commands the printer treat ~ as internal command for the mag stripe Please download the DTC550 user guide from HID Tech Support and see the Mag section
    ---------------
    My problem is that I cant find the command that tells the printer to start encoding.
    The printer is connected by USB now, but can also connect by LAN. I have printed a picture from paint on it.

  4. #4
    Join Date
    Nov 2010
    Posts
    5
    Rep Power
    0

    Default

    I have just created a small test program that writes to the printer, so it’s not a problem to print from Java.
    import java.awt.print.PageFormat;
    import java.awt.print.Paper;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;

    /**
    *
    * @author JP
    */
    public class Main {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    PrinterJob job = PrinterJob.getPrinterJob();

    // Hent default pageformat fra windows standardprinter
    PageFormat pf = job.defaultPage();
    Paper pa = new Paper();

    // Gr hele papiret skrivbart - IKKE sikkert printeren kan skrive i fuld bredde
    pa.setImageableArea(0, 0, pf.getWidth(), pf.getHeight());
    pf.setPaper( pa );

    ToPrinter tp = new ToPrinter("Test");

    // Brug papirformat til printjob
    job.setPrintable(tp, pf);

    try{
    job.print();
    }
    catch (PrinterException p){
    }
    }
    }
    //////////////////////////////////////////////////
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.Font;

    class ToPrinter implements Printable{


    public ToPrinter(String dfPrinter){
    this.df = dfPrinter;
    }

    public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
    int NO_SUCH_PAGE = 0;
    if(pageIndex == 1) return NO_SUCH_PAGE;

    Graphics2D g2 = (Graphics2D)g;
    g2.setFont(new Font("Serif", Font.BOLD, 7));

    g2.translate((int)pf.getImageableX(), (int)pf.getImageableY());
    g2.drawRect(0,0,150,50);
    g2.drawString( df, 10, 10);
    g2.drawString( "Papirbredde i mm: " + (int)( (pf.getWidth() / 300) * 25.4), 10, 25 );
    int PAGE_EXISTS = 0;

    return PAGE_EXISTS;
    }

    private String df;

    }

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    I've never used one of these things before, only readers.
    Do you know if anything is ending up on the mag strip?
    I'm assuming there isn't.

  6. #6
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    They have to give you API answer or you cannot do anything really.

    In User Guide, you can only find info about
    format of commands, but they use them with software they provide...And Telnet command list is useless too.

    Using the Magnetic Encoding tab

    page238
    Reviewing the Sample String
    Sending Data to Track 1: ~1%JULIEANDERSON^1234567890?
    Sending Data to Track 2: ~2;1234567890987654321?
    Sending Data to Track 3: ~3;1234567890987654321?
    This is their example for printing:

    page 131
    Resolving the Printer not reading Encoded Magnetic Track Data

    a. Use WordPad (a Windows 95/ 98/ ME/ NT/ 2000/XP word processing
    program in the Accessories Program Group), as shown on the next page.

    b. Open the program and type in: ~1%JULIEANDERSON^1234567890?

    c. Select File > Page Setup and click on the Printer button.

    d. Ensure that the DTC550 Series Card Printer is selected and click on

    OK.

    e. Change all the margin settings to zero (0) and click on OK.

    f. Go to File on Menu Bar and select Print. (Note: The Printer should
    then feed a card into the Encoder and magnetically encode it.)
    call them!

  7. #7
    jeev81 is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default hi........

    Hi,

    I happen to find a link related to this I dont know if it might be of use to you.Anyway's the link is as below :

    Magnetic Track Data Parsers Acme Technologies Zeitgeist

    Regards,
    Rajeev

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    You should be able to mimic all that.
    That would be my first shot...and have a reader handy to check it's worked.

  9. #9
    Join Date
    Nov 2010
    Posts
    5
    Rep Power
    0

    Default

    No, nothing is ending up on the mag stripe. It’s that command I don’t know. I decompiled a DLL file from Fargo to find out which command there was used there, but nothing from the file was similar in Java.

    Ex.

    ////
    mports System
    Imports System.ComponentModel
    Imports System.Runtime.CompilerServices
    Imports DevExpress.XtraBars
    Imports DevExpress.XtraEditors
    Imports Fargo.Workbench.Properties

    Namespace Fargo.Workbench

    Public Class EncodingModeSelect
    Inherits XtraForm

    <CompilerGenerated> _
    Private <Track1EncodeMode>k__BackingField As TrackEncodeMode
    <CompilerGenerated> _
    Private <Track2EncodeMode>k__BackingField As TrackEncodeMode
    <CompilerGenerated> _
    Private <Track3EncodeMode>k__BackingField As TrackEncodeMode
    Private btnCancel As SimpleButton
    Private btnOk As SimpleButton
    Private components As IContainer
    Private grpOptions As GroupControl
    Private label1 As LabelControl
    Private label2 As LabelControl
    Private label3 As LabelControl
    Private label4 As LabelControl
    Private MagTypeTrack1 As ComboBoxEdit
    Private MagTypeTrack2 As ComboBoxEdit
    Private MagTypeTrack3 As ComboBoxEdit
    Private popupMenu1 As PopupMenu

    Public Property Track1EncodeMode As TrackEncodeMode
    Get
    Return <Track1EncodeMode>k__BackingField
    End Get
    Set
    <Track1EncodeMode>k__BackingField = value
    End Set
    End Property

    Public Property Track2EncodeMode As TrackEncodeMode
    Get
    Return <Track2EncodeMode>k__BackingField
    End Get
    Set
    <Track2EncodeMode>k__BackingField = value
    End Set
    End Property

    Public Property Track3EncodeMode As TrackEncodeMode
    Get
    Return <Track3EncodeMode>k__BackingField
    End Get
    Set
    <Track3EncodeMode>k__BackingField = value
    End Set
    End Property

    Public Sub New()
    InitializeComponent()
    End Sub

    Private Sub btnOk_Click(ByVal sender As Object, ByVal e As EventArgs)
    SaveChanges()
    End Sub

    Private Sub EncodingModeSelect_Load(ByVal sender As Object, ByVal e As EventArgs)
    ' trial
    End Sub

    Private Sub InitializeComponent()
    ' trial
    End Sub

    Private Sub MagTypeTrack1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    ' trial
    End Sub

    Private Sub MagTypeTrack2_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    If MagTypeTrack2.Text = Resources.JISIIEncoding Then
    MagTypeTrack1.SelectedIndex = 0
    MagTypeTrack3.SelectedIndex = 0
    End If
    End Sub

    Private Sub MagTypeTrack3_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    ' trial
    End Sub

    Private Sub SaveChanges()
    Track1EncodeMode = DirectCast(Enum.ToObject(GetType(TrackEncodeMode), MagTypeTrack1.SelectedIndex), TrackEncodeMode)
    Track2EncodeMode = DirectCast(Enum.ToObject(GetType(TrackEncodeMode), MagTypeTrack2.SelectedIndex), TrackEncodeMode)
    Track3EncodeMode = DirectCast(Enum.ToObject(GetType(TrackEncodeMode), MagTypeTrack3.SelectedIndex), TrackEncodeMode)
    Dim i1 As Integer = MagTypeTrack1.SelectedIndex
    Settings.UpdateSetting(Settings.EncodeModeTrack1, i1.ToString())
    Dim i2 As Integer = MagTypeTrack2.SelectedIndex
    Settings.UpdateSetting(Settings.EncodeModeTrack2, i2.ToString())
    Dim i3 As Integer = MagTypeTrack3.SelectedIndex
    Settings.UpdateSetting(Settings.EncodeModeTrack3, i3.ToString())
    End Sub

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing AndAlso (Not (components) Is Nothing) Then
    components.Dispose()
    End If
    MyBase.Dispose(disposing)
    End Sub

    End Class ' class EncodingModeSelect

    End Namespace

  10. #10
    Join Date
    Nov 2010
    Posts
    5
    Rep Power
    0

Similar Threads

  1. Need encoding for Korean
    By RamaNalayini in forum Advanced Java
    Replies: 1
    Last Post: 11-25-2010, 02:34 PM
  2. arabic encoding in url
    By echoe_echoe in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 10-06-2010, 08:10 AM
  3. problem in encoding
    By jaysh in forum NetBeans
    Replies: 0
    Last Post: 08-26-2010, 08:07 AM
  4. encoding issue in jsp
    By sams11 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-25-2008, 07:55 AM
  5. Some help with encoding...
    By nm123 in forum Networking
    Replies: 0
    Last Post: 04-15-2008, 12:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •