Bartender 9.4 Weblabelprint ? S’abonner

0
Avatar
Legacy Poster

Hello,

I am trying to create a .NET 4.0 web application which is used to print barcodes using BarTender 9.4 SDK & Internet Printing method of the Web Print Server. (Seagull\BarTender Suite\SDK\Print Server SDK Samples\WebLabelPrint\VB)
All I need is for a web page to print a single predefined label. The .btw is stored within the .NET solution already. I have also added reference to Seagull.BarTender.Print. Is there a good walk-through for this kind of task? Or can anyone help me out to get this ball rolling? I don't see one in the SDK documentation.

default.aspx
[code]<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="BarTender._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<p>
<asp:Button ID="btnPrint" runat="server" Text="Button" />
</p>
</asp:Content>[/code]

default.aspx.vb
[code]Imports Microsoft.VisualBasic
Imports System
Imports System.Configuration
Imports System.Web.UI

Imports Seagull.BarTender.Print
Imports Seagull.BarTender.PrintServer
Imports Seagull.BarTender.PrintServer.Tasks

Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click
Print()
End Sub

Public Sub Print()
Try
Dim taskManager As TaskManager = CType(Application("TaskManager"), TaskManager)

' Make sure the task manager is valid and that engines are running.
If (taskManager IsNot Nothing) AndAlso (taskManager.TaskEngines.AliveCount <> 0) Then
Dim labelFormat As LabelFormat = CreateLabelFormatFromPageData(_listLabelFormats.SelectedLabelFormatRepositoryFullPath)
If labelFormat IsNot Nothing Then
Dim taskPrint As New PrintLabelFormatTask(labelFormat)
taskPrint.PrintTimeout = Int32.Parse(ConfigurationManager.AppSettings("PrintTimeout"))

If _listPrinters.LastPrintType = "client" Then
' Since the client print needs to post-process the print job, sign up for the succeeded event.
AddHandler taskPrint.Succeeded, AddressOf TaskPrint_Succeeded
End If
taskManager.TaskQueue.QueueTaskAndWait(taskPrint, 60000)

' Get messages
For Each message As Message In taskPrint.Messages
Dim formattedMessage As String = message.Text.Replace(Constants.vbLf, "<br/>")
_alert.AddMessage(formattedMessage & "<br/>")
Next message
End If
Else
ShowMessage("Unable to print. Please make sure you have BarTender installed, activated as <br />Enterprise Print Server edition, and that print engines are running. See the <br />'Manage Print Engines' menu task.")
End If
Catch ex As Exception
ShowMessage(ex.Message)
End Try
End Sub
End Class[/code]

1 commentaires

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Hi Ahelbling,

As BarTender .net Print / Print Server SDK is built by .net Framework 2.0, for testing purpose please begin with .net 2.0 (or 3.5) project.
.net 4.0 is not compatible with previous .net Framework, you need mixed mode setting discussed in [url="http://seagullscientific.invisionzone.com/index.php?/topic/248-net-sdk-compatibility-with-net-framework-40"]This post[/url].

Attached is a documentation about Web Label printing (updated to support BT10.0) - please check that.

[attachment=250:WebLabelPrinting.pdf]

Vous devez vous connecter pour laisser un commentaire.