| |
   
Morovia.com Home | Fonts | Components | Labeling | Library | Order | Forum
  Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
General Discussion
 Community Forum : General Discussion
Subject Topic: Writing Barcode jpg to disk file Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
jhowell
Newbie
Newbie


Joined: June 22 2006
Location: United States
Posts: 2
Posted: June 22 2006 at 10:03am | IP Logged Quote jhowell

Hi--

We are using version 3.2 and are, so far, not able to use the 'ExportImage' method to write a jpg image to a folder on our server.  The dll is creating a foo.jpg file, but it is shown as broken (red 'X') in a viewer.  I opened one of the files with a hex editor and it appears to have the barcode information in it, but as ascii text, not binary data.  I'm including the snippet of classic ASP that is calling the dll.

Any and all help is deeply appreciated!!

 

Dim objBarcode, objStream

Set objBarcode = Server.CreateObject("Morovia.BarcodeActiveX") objBarcode.RasterImageResolution = 96 objBarcode.BorderStyle = 0 objBarcode.ShowComment = false objBarcode.ShowHRText = trueobjBarcode.SymbolMarginTop = 100objBarcode.Symbology = 5 objBarcode.NarrowBarWidth = Request.QueryString("NarrowBarWidth")objBarcode.BarHeight = 500

objBarcode.Message = Request.QueryString("Message") & ".jpg"

objBarcode.ShowHRText = Request.QueryString("ShowHRText")

objBarcode.Font.Size = 9

objBarcode.Font.Name = "Arial"

objBarcode.Font.Bold = True

objBarcode.ShowComment = false

IF (objBarcode.Symbology = mbxInterleaved_2of5 ) THEN

objBarcode.Font.Bold = false 'SCC14 printed with normal font style

objBarcode.BearerBars = true 'Add bearer bars to SCC14

END IF

Set objStream = Server.CreateObject("ADODB.Stream")

objStream.Type = adTypeBinary

objStream.Open

objBarcode.ExportImage objStream, 1

objStream.Position = 0

objStream.SaveToFile "D:\Tradein\Motorola\TradeIn\Barcodes\" & Mailer_label & ".jpg" , 1

'Response.write "<br>Image: <img src='" & Mailer_label & ".jpg' >"

Response.BinaryWrite objStream.Read

objStream.Close

Set objStream = Nothing

Set objBarcode = Nothing

 

Thanks in advance--

--Jim

 

Back to Top View jhowell's Profile Search for other posts by jhowell
 
glitch
Admin Group
Admin Group
Avatar

Joined: January 25 2003
Location: Canada
Posts: 280
Posted: June 22 2006 at 12:06pm | IP Logged Quote glitch

Jim,

We examined your source code and found that you used QueryString to get several parameters. It would be better to check if an invalid value is passed.

(1) I suspect that you did not pass the NarrowBarWidth. So it becomes 0. This makes the barcode disappear. I would suggest you change to something below

If (CInt(Request.QueryString("NarrowBarWidth")) < 10 ) Then
 objBarcode.NarrowBarWidth = 10
Else
 objBarcode.NarrowBarWidth = Request.QueryString("NarrowBarWidth")
End If

Note - since you specify the image to be created under 96 dpi, you should not pass a value below half of the pixel size (5 mils) to NarrowBarwidth. Otherwise the program will round it to 0.

(2) I also have questions on this statement:

objBarcode.Message = Request.QueryString("Message") & ".jpg"

This statement will throw an expcetion for numeric symbologies such as Code25 and Interleaved 2 of 5, since they only encode numeric data.

We modified your script a little bit and it runs well on our server. Let me know if they work for you.



Edited by glitch on June 22 2006 at 12:08pm
Back to Top View glitch's Profile Search for other posts by glitch Visit glitch's Homepage
 
jhowell
Newbie
Newbie


Joined: June 22 2006
Location: United States
Posts: 2
Posted: June 22 2006 at 1:36pm | IP Logged Quote jhowell

Glitch--

  Thanks for the quick reply. We are testing this right now.

Best Regards --Jim

 

 

Back to Top View jhowell's Profile Search for other posts by jhowell
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.3281 seconds.