Page 1 of 1

2D-Code from Outlook contact

Posted: Mon Mar 04, 2013 2:14 pm
by volkerkunze
Hello,

is it possible to create an 2D-Barcode by assigning an outlook contact file (*.vcf) to the barcode writer?

Greetings from Germany
Volker

Re: 2D-Code from Outlook contact

Posted: Mon Mar 04, 2013 3:52 pm
by Alex
Hello Volker,

Yes, this is possible. You need get content of an outlook contact file as binary data and create 2D barcode from the binary data.

Best regards, Alexander

Re: 2D-Code from Outlook contact

Posted: Mon Mar 04, 2013 5:31 pm
by volkerkunze
Hello Alex,

thanks for your reply. I tried the following code:

Code: Select all

Friend Shared Function GetStringFromVCard() As String

        Dim inFile As System.IO.FileStream
        Dim binaryData As Byte()

        inFile = New System.IO.FileStream(<filename>.vcf,
             System.IO.FileMode.Open,
             System.IO.FileAccess.Read)

        ReDim binaryData(CInt(inFile.Length))

        Dim bytesread As Integer = inFile.Read(binaryData, 0, CInt(inFile.Length))

        inFile.Close()

        Dim base64string As String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length)

        Return base64string

    End Function
If I copy the returned string into the BarcodeWriter's <value> property, I get an error "Data region is too large". The string has got more than 7.000 characters. Is this too long for any Barcode or is anything wrong in my code? I tried QR, Aztec, DataMatrix, MaxiCode

Best regards,
Volker

Re: 2D-Code from Outlook contact

Posted: Tue Mar 05, 2013 11:10 am
by Alex
Hello Volker,

2D barcode can contain maximum 2.5K characters.

You can go 2 ways if you have more than 2.5K characters:
  • Compress your data. I think the contact information can be well compressed. This is the best way.
  • Use the structure append feature and combine up to 16 2D barcodes in one 2D barcode. This is not the best way, because the structure append feature must be used in very special cases.
The example that shows how to write and read the structure append character you can find in the documentation in the overview of the Vintasoft.Barcode.BarcodeInfo.StructureAppendCharacter class:
http://www.vintasoft.com/docs/vsbarcode ... acter.html

Best regards, Alexander