CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 How Do I???

Print topic Send  topic

Author Message
Lindsay
Posted: 10/06/2003, 3:22 PM

Print lables from a code charge application to my printer? In asp. On Windows 2000 Server. IIS 5.0
Admin - CodeChargers
Posted: 10/06/2003, 4:01 PM

You need to write the code to enable your 'application' to do this... can't help a lot without knowing which version of Code Charge your using..

Quick thought... You could place a Html Button on your page - window.print(), set the 'Format Language' to 'Javascript' and include the output settings for the labels, then add Format onclick event to the code in the code window.


Regards
Admin - CodeChargers

http://www.CodeChargers.com
Lindsay
Posted: 10/06/2003, 4:34 PM

I am using code charge 2.0 With Access Database
ryan
Posted: 10/06/2003, 9:12 PM

on your CCS html file
------------------------------
<html>
<head>
<title>Thread</title>
<link rel="stylesheet" type="text/css" href="Themes/NoMarks/Style.css">
<script type="text/Javascript" language="Javascript">
function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) window.print()
}
</script>

</head>
<body OnLoad="javascript:printWindow();" class="NoMarksPageBODY">
<!--
Your HTML here
-->
</body>
</html>
------------------------------
Lindsay
Posted: 10/14/2003, 7:29 AM

I am using asp to access a database with addresses. I want to print address lables on avery 5160 lables. How would I do that?


Please help me I am stuck.



Lindsay
rclayh
Posted: 10/17/2003, 6:46 AM

Lindsay,

Printing from a web application is not a good idea because of some limitations with the web browser. You have two options -

1) Create a desktop app instead or
2) Generate a PDF on the fly on the server and send it down to the computer

Otherwise you are going to find you pick a tough row to hoe.
Walter
Posted: 10/26/2003, 8:24 AM

Hi Lindsay,
I have to say that I agree that printing lables from a browser is a bad idea. I have tried it in the past and was disapointed. I also spent weeks looking for a solution on the internet with no success. dynamic .pdf was the only solution that seemed it could work but I chose to use a desktop program to solve the problem (however this is only a help if you have only a few computers printing the lables and you have access to them). I was using mysql and so I chose MySql studio to print the lables. It allows you to creat and print lables from your database, this does not involve your webpages only the database. Again this my not help you if you need anyone to be able to print the lables. If this is the case I would try a dynamic .pdf or a dynamic .rtf.
Good luck,
Walter
feha
Posted: 10/26/2003, 2:42 PM

I think it can be done with FPDF library...
I have done a real-time/MySQL price list for my WebShop and it works well
planing to use it for invoice system...
But it can be done for labels too..

www.vision.to/webshop/

login:guest@vision.to
pass: guest

And you will be able to view the price list in real-time ...

regards
feha
[www.vision.to]
Rick
Posted: 10/29/2003, 11:52 AM

I think the activePDF product may be able to generate PDF based labels and be dovetaied with CC. See:
http://www.activepdf.com/en/Start.asp
Hamilton
Posted: 10/30/2003, 7:28 AM

First, you need to create a couple of routines that will;
1) Perform a SQL Query against your db to get the name and address fields, etc.
2) Format the Name and address values
3) Write the names and addresses to a file on your hdd. (Ensure IUSR_<MACHINE_NAME> has permissions to write to the directory you write the file to)

Below is a chopped down version of some code that I use to produce the txt file containing the names & addresses to be printed. Then from MS Word, this file is used to perform the mail merge.

Start off by placing this into notepad, call the file "LabelOutput.asp" or something.

Modify the connection strings, sql query and so forth....

Once you get the code to run, you can then port the routines anywhere.

'*********************************************************************
<!-- METADATA TYPE="typelib" UUID="00000200-0000-0010-8000-00AA006D2EA4" NAME="ADO Type Library" -->
<%
'// Define database connection string.
Dim CONNECT_STRING : CONNECT_STRING = "uid=;pwd=;driver={SQL Server};server=<YOUR SERVER NAME>;database=<YOUR DB NAME>;"

%>
<%
Function PrepareMailMerge()
Dim strDocumentPath
Dim strDocumentName
Dim strNewDocument
Dim strDocumentContents
Dim strDocumentContents_ORG
Dim strDocumentContentSavedSoFar
Dim strAppended

Dim y
Dim i
Dim MyStr
Dim DT
Dim fldStr
Dim fldCT
Dim thisFile
Dim membername
Dim addr1
Dim addr2
Dim addr3
Dim USstate
Dim city
Dim zip
Dim sMEMBER_NAME_ADDRESS
Dim sACCOUNT
Dim sFirstName
Dim sMiddleName
Dim sLastName
Dim SQL
Dim iDocCount
Dim sCount
Dim blnDocCreated
Dim DocDate
Dim intNumAddrLines : intNumAddrLines = 0
Dim sHeader

strDocumentPath = "C:\Inetpub\wwwroot\<WEB SITE NAME>\LABELOUTPUT\"
strDocumentName = "AveryLabel_" & FormatDateTime(Now(), vbShortDate) & ".txt"
strDocumentName = Replace(strDocumentName, "/", "")
'Response.write strDocumentPath & strDocumentName & "<BR>"

SQL = "SELECT Members.*,"
SQL = SQL & " MEMBER_FILE.ADDRESS_LINES_1,"
SQL = SQL & " MEMBER_FILE.ADDRESS_LINES_2,"
SQL = SQL & " MEMBER_FILE.ADDRESS_LINES_3,"
SQL = SQL & " MEMBER_FILE.CITY,"
SQL = SQL & " MEMBER_FILE.STATE,"
SQL = SQL & " MEMBER_FILE.ZIP "
SQL = SQL & " FROM MEMBERS"

Set db = Server.CreateObject("ADODB.Connection")
Set rs = server.CreateObject("ADODB.RecordSet")
db.Open CONNECT_STRING

Set rs = db.Execute(SQL)

iDocCount = 1 : i=1


Do Until rs.EOF
sFirstName = Generic_MakeAllTitleCase(rs.fields("FIRST_NAME"))
sMiddleName = Generic_MakeAllTitleCase(rs.fields("MIDDLE_NAME"))
sLastName = Generic_MakeAllTitleCase(rs.fields("LAST_NAME"))
addr1 = Generic_MakeAllTitleCase(rs.fields("ADDRESS_LINES_1"))
addr2 = Generic_MakeAllTitleCase(rs.fields("ADDRESS_LINES_2"))
addr3 = Generic_MakeAllTitleCase(rs.fields("ADDRESS_LINES_3"))
city = Generic_MakeAllTitleCase(rs.fields("CITY"))
USstate = Trim(rs.fields("STATE"))
zip = rs.fields("ZIP")
If Len(zip) = 4 Then zip = "0" & zip 'handles Eastern US State Zip Codes where db.zipcode is an integer

membername = sFirstName & " " & sMiddleName & " " & sLastName

sMEMBER_NAME_ADDRESS = ""
If Len(addr1)<> 0 Then
sMEMBER_NAME_ADDRESS = sMEMBER_NAME_ADDRESS & addr1 & ","
If intNumAddrLines <= 1 then intNumAddrLines = 1
End If

If Len(addr2)<> 0 Then
sMEMBER_NAME_ADDRESS = sMEMBER_NAME_ADDRESS & addr2 & ","
If intNumAddrLines < 3 then intNumAddrLines = 2
End If

If Len(addr3)<> 0 Then
sMEMBER_NAME_ADDRESS = sMEMBER_NAME_ADDRESS & addr3 & ","
If intNumAddrLines < 4 then intNumAddrLines = 3
End If


sMEMBER_NAME_ADDRESS = sMEMBER_NAME_ADDRESS & city & "," & USState & "," & Zip

strDocumentContents = strDocumentContents & membername & "," & sMEMBER_NAME_ADDRESS & vbCRLF

iDocCount = iDocCount + 1 : i = i + 1

rs.movenext
Loop

If rs.State=adStateOpen Then rs.close
If db.State=adStateOpen Then db.close

'//Generate Header
i=0
intNumAddrLines = 3
sHeader = "Member_Name,"
for i = 1 to intNumAddrLines
sHeader = sHeader & "addresslines_" & i & ","
next
sHeader = sHeader & "city,state,zip"
'Response.write sHeader & "<BR>"
strDocumentContents = sHeader & vbCRLF & strDocumentContents

strDocumentContents = Replace(strDocumentContents, " ,", ",")
Call WriteMailMergeToFile(strDocumentPath & strDocumentName, strDocumentContents)

End Function
%>

<%
Function WriteMailMergeToFile(fileName, sTextToWrite)
On Error Resume Next
Const openForReading = 1
Const openForWriting = 2
Const openForAppending = 8
Dim f
Dim fso
Dim txtStream
Dim txtInDoc

Set fso = Server.CreateObject("Scripting.FileSystemObject")

'// If the file exists - delete it and start fresh
If fso.FileExists(fileName) Then
Set txtStream = f.OpenAsTextStream(openForReading)
txtStream.DeleteFile(fileName)
'Response.write "Deleting " & filename & "<BR>"
End If

If fso.FileExists(fileName) Then
'Set txtStream = f.OpenAsTextStream(openForReading)
Set txtStream = f.OpenAsTextStream(openForWriting)
txtInDoc = txtStream.OpenTextFile(fileName, 1, False)

txtStream.Close
'txtStream.DeleteFile(fileName)
End If

Set txtStream = fso.CreateTextFile(fileName, True)
Set f = fso.GetFile(fileName)
Set txtStream = f.OpenAsTextStream(openForAppending)
' Append lines to the file
txtStream.WriteLine sTextToWrite '"Appending line to the text file"

txtStream.Close
If Not txtStream Is Nothing Then Set txtStream = Nothing
If Not f Is Nothing Then Set f = Nothing
If Not fso Is Nothing Then Set fso = Nothing
End Function
%>

<%
Function Generic_MakeAllTitleCase(ByVal strWord)

'----------------------------[Error CHECK]----------------------------
If strWord = "" or isnull(strWord) Then
If Len(strWord) = 0 Then Exit Function
'Response.write("The parameter strWord - IS REQUIRED")
'Response.End
End IF

'----------------------------[/Error CHECK]----------------------------

Dim arrTemp
Dim strFirstLetter
Dim strRestOfWord
Dim strFinalWord
Dim strFinalString



' We remove any spaces from the Start and the END
strWord = Trim(strWord)

' We remove any double spacing or anything of that kind we do that up to 10 spaces
strWord = Replace(strWord," "," ")
strWord = Replace(strWord," "," ")
strWord = Replace(strWord," "," ")
strWord = Replace(strWord," "," ")
strWord = Replace(strWord," "," ")
strWord = Replace(strWord," "," ")
strWord = Replace(strWord," "," ")
strWord = Replace(strWord," "," ")


arrTemp = Split(strWord," ")
strFinalString = ""

For each I in arrTemp
' We find the first Letter of our elemente in the array e.g. [ h ] and make it Upper Case always
strFirstLetter = Ucase(Left(I,1))

' We find the rest of the word e.g. [ ello ] and make it lower case always
strRestOfWord = Lcase(Right(I,Len(I)-1))

' We recreate the Final Word
strFinalWord = strFirstLetter & strRestOfWord

' We append our Final string
strFinalString = strFinalString & strFinalWord & " "
Next

' We pass our final string into our function
Generic_MakeAllTitleCase = strFinalString

End Function
%>
'*********************************************************************

I hope this is of some help, or at the very least points you in the right direction.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.