473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Printing an image from file on a network

Hutt
5
Hi,

asp.net (vb).
I have developed a site in test on my PC which runs a process and outputs a jpeg image to a folder in C:\inetpub\wwwroot\images, and I can print it from a button on my page using vb with document.print().
However, when I move the site to our server the print no longer works. I understand this is because the image is now on the server along with the vb code.
So my question is how can a client on a network get the image file from the server and print it with the simple click of a button on the web page? I have tried looking into Javascript to do this, but all I can find are examples that print the current page, not an image file from a server.
Thank you.
Feb 18 '08 #1
6 1293
kenobewan
4,871 Expert 4TB
This is probably easier than you think. Use an IP or domain to access page and print image (IIS). On a large network you will have a server that hosts your (intranet) application. HTH.
Feb 18 '08 #2
Hutt
5
Hi,
Thanks for replying, but I'm relatively new to .net and need some clearer advice. Yes my application is on a network web server, and this is where the jpeg image file sits. The client could open the image in a browser to print, but that doesn't work because it only ever prints part of the image (despite changing printer settings to fit to page), and this involves another step for the user. When I host the app locally my .net code fits the image to the A4 page and prints , so I am looking for some code that will work when it is hosted on the web server and the client wants to print the image.
Below is the code that runs on my PC but not when on the server, apparently I have to use the path to the image, a URL is no good:

Sub DocumentPrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
Dim theCompleteImage As New Drawing.Bitmap("C:\Inetpub\wwwroot\Prints\" + _imgStr + ".jpg")
Try
'Actual image is larger, this will fit to print page A4P
e.Graphics.DrawImage(theCompleteImage, 0, 0, 740, 1110)
Finally
theCompleteImage.Dispose()
End Try
End Sub

Public Sub PrintMethod(ByVal strInput As String)
_imgStr = strInput 'the image name
Dim document As New Drawing.Printing.PrintDocument()
AddHandler document.PrintPage, AddressOf DocumentPrintPage
document.Print()
End Sub
Feb 18 '08 #3
kenobewan
4,871 Expert 4TB
Hint - IP or domain replaces your local drive. HTH.
Feb 19 '08 #4
Hutt
5
Hint - IP or domain replaces your local drive. HTH.
Hi,
If I change the line to:
Dim theCompleteImage As New Drawing.Bitmap("http://localhost/Prints/" + _imgStr + ".jpg")
and run the app it highlights this line of code, with a message 'URI formats are not supported'. What am I missing?
Thanks.
Feb 19 '08 #5
kenobewan
4,871 Expert 4TB
Must admit that was a surprize, apparently you use Server.MapPath().
Feb 20 '08 #6
I've got the same problem. This link will help you:
http://www.csharphelp.com/board2/rea...&i=9298&t=9289
Good luck!
Feb 27 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
5
by: VMI | last post by:
I have a BMP image (the form is also in PDF) that contains a scanned copy of a paper form that we need to fill out. Is it possible to use this image in my application so that the application can...
0
by: lubprog | last post by:
hi, I am printing jpg files which are on a disk. The file name is selected from a database and the file is located on the disk and then printed. I am able to print the file but it takes a long...
1
by: John Thompson | last post by:
We're sooo close. When we load the page to upload the image, all of the prms go through except the binary image data. Using SQL server with the data type set to "image". Please help! Thanks-...
5
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.