Using Barcode1DWrite method in javascript

Discussions about GdPicture.NET usage in non managed applications built in vb6, Delphi, vfp, MFC c++ etc...
Post Reply
fewezee
Posts: 4
Joined: Mon May 07, 2012 4:02 pm

Using Barcode1DWrite method in javascript

Post by fewezee » Fri Jun 08, 2012 11:48 am

Hello guys,

I have tried all my possible best to get this working to no avail. I have been testing in a vb.net web application, using Barcode1DWriterCode128, how to

1. Generate, display in gdviewer, print the barcode label (this is not be saved)
2. Write the barcode to an existing document / image displayed in the GDViewer and save to a network location

From all I have read in the forums and the documentation this can only be achieved using javascript.

I have tried generating the barcode server side and it works perfectly well. I could generate the label and save as tiff. I could also add the barcode to an existing file saved ont the system.

Below is code I used. It keeps on giving me "Could not complete the operation due to error 80131509" and fails at Barcode1DWrite function. Could this be failing because I used the actual value of 26 for Barcode1DWriterType.Barcode1DWriterCode128? How do I call that enumerator in the function.

Code: Select all

function addBarcode() {
        var oGdViewer = document.getElementById("GdViewer1");
       var ImageID = m_GdPictureImaging.CreateNewGdPictureImage(200, 200, 24, oGdViewer.ARGBI(255, 255, 255, 255));

        m_GdPictureImaging.Barcode1DWrite(ImageID, 26, "222", 1, 1, 150, 50, m_GdPictureImaging.ARGBI(255, 0,0,0));
        m_GdPictureImaging.FontSetUnit(2);
        m_GdPictureImaging.DrawText(ImageID, "222", 5, 150, 12, 0, oGdViewer.ARGBI(255, 0, 0, 0), "Verdana", true);
        oGdViewer.DisplayFromGdPictureImage(ImageID);
        oGdViewer.SetZoom100();
        oGdViewer.Redraw();
       // oGdViewer.Print();
    }
::bug::
Any fix or solution will be greately appreciated as i am wringing my hands and biting my nails at this point. Totally stumped. Short of pulling my hair off!!!

PS: I used the AnyCPU/aspnet/anotatation sample and just added the function.

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Using Barcode1DWrite method in javascript

Post by SamiKharma » Mon Jun 11, 2012 11:52 am

Hi,

I have copied your code to a c# project and you have two errors:
1. As you said the enumeration, just call GdPicture.Barcode1DWriterType.Barcode1DWriterCode128
2. The Color, you are using ARGI when you should use ARGB because you need a color object and not a color integer.

If you do that it should work.

Best Regards,
Sami

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Using Barcode1DWrite method in javascript

Post by Loïc » Mon Jun 11, 2012 4:58 pm

Hello,

The problem is a little more complicated.

Please first have a look on this thread:

viewtopic.php?t=3757

And then download the latest 8.5.32

And there use this code ;)
var oGdViewer = document.getElementById("GdViewer1");
var ImageID = m_GdPictureImaging.CreateNewGdPictureImage(200, 200, 24, oGdViewer.ARGBI(255, 255, 255, 255));

m_GdPictureImaging.Barcode1DWrite_3(ImageID, 26, "222", 1, 1, 150, 50, m_GdPictureImaging.ARGBI(255, 0,0,0), 0, 0);
oGdViewer.DisplayFromGdPictureImage(ImageID);
oGdViewer.SetZoom100();
oGdViewer.Redraw();
// oGdViewer.Print();
Let us know if the problem persists.

With best regards,

Loïc

fewezee
Posts: 4
Joined: Mon May 07, 2012 4:02 pm

Re: Using Barcode1DWrite method in javascript

Post by fewezee » Wed Jun 13, 2012 1:31 pm

Hello Loic,

Thanks for the update. It worked. U rock. :D On the other hand I think it would be better to notify users if feature requested / bug noticed is WIP ( work in Progress). At least it would us hope. At a point I was really frustrated and angry that there was no response and had to look at other alternatives.

Thanks all the same.... :mrgreen:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest