2D-Code from Outlook contact

Questions, comments and suggestions concerning VintaSoft Barcode .NET SDK.

Moderator: Alex

Post Reply
volkerkunze
Posts: 2
Joined: Mon Mar 04, 2013 2:10 pm

2D-Code from Outlook contact

Post by volkerkunze » Mon Mar 04, 2013 2:14 pm

Hello,

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

Greetings from Germany
Volker

Alex
Site Admin
Posts: 1474
Joined: Thu Jul 10, 2008 2:21 pm

Re: 2D-Code from Outlook contact

Post by Alex » Mon Mar 04, 2013 3:52 pm

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

volkerkunze
Posts: 2
Joined: Mon Mar 04, 2013 2:10 pm

Re: 2D-Code from Outlook contact

Post by volkerkunze » Mon Mar 04, 2013 5:31 pm

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

Alex
Site Admin
Posts: 1474
Joined: Thu Jul 10, 2008 2:21 pm

Re: 2D-Code from Outlook contact

Post by Alex » Tue Mar 05, 2013 11:10 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest