I have a small task on asp.net, I want to print a text data to receipt printer from web page, I used the following code and it works fine on my local machine:
Service service = null;
protected void Page_Load(object sender, EventArgs e)
{
try
{
ServiceFunc serv = new ServiceFunc();
service = [login to view URL]([login to view URL](Session["servid"]));
printpage();
}
catch (Exception ex)
{ }
}
public void printpage()
{
PrintDialog pd = new PrintDialog();
PrintDocument pdoc = null;
pdoc = new PrintDocument();
[login to view URL]("1");
PrinterSettings ps = new PrinterSettings();
Font font = new Font("Courier New", 12);
PaperSize psize = new PaperSize("Custom", 300, 400);
[login to view URL] = pdoc;
[login to view URL] = psize;
[login to view URL] = 600;
[login to view URL] = 300;
[login to view URL]("2");
[login to view URL] += new PrintPageEventHandler(pdoc_PrintPage);
[login to view URL]("3");
PrintPreviewDialog pp = new PrintPreviewDialog();
[login to view URL] = pdoc;
[login to view URL]("4");
[login to view URL]();
[login to view URL]("5");
}
void pdoc_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics graphics = [login to view URL];
Font font = new Font("Courier New", 10);
[login to view URL]("XXX", new Font("Courier New", 9), new SolidBrush([login to view URL]), startX, startY + Offset);
}
but on Server it gives me : Forbidden: You don't have permission to access cache on this server. ... 403 .
if you have a solution or another way to print, I will award the task to you.
Hello,
I have reviewed your project posting and are very much excited to assist you in your project. I would appreciate if we can connect over private message or other medium to discuss about the project and provide you with accurate details.
We are a professional company with experience of over 7 years. We have worked with MNCs and government counties to develop solutions for them. We can be a one stop shop for all your development needs. We have expert developers for all the technologies and platforms mentioned in the project. Unlike an individual freelancer, we are a professional company with proven track record. We can provide timely, scalable and cost effective solutions.
We have state of the art development center. We have wide range of mobile devices & tablets on Android, iOS, Windows, RIM & Symbian platforms. We have latest windows & MAC PCs and servers. So you can associate with us and get the advantage of this technology without requiring a big investment at your end.
Regards
Starco Enterprise
There can be multiple reasons you could get that error. If you have full administrative access to the server, it should be an easy and quick fix. I'm sure I can fix this for you quickly. Thanks
Just run the above code on the server it would start working, since you are accessing the server from local machine this type of error comes. PM me if it didn't work.
Dear,
i can use print as you use but it will be better if you use crystal report
but any way i can help
please contact me and it will be done with in 3 hour
thanks
amr wafa
Company Name: SHREEDHOON INFOTECH
Description of Company:
Shreedhoon infotech is a IT development company with extremely talented employees. Our office is located in Gandhinagar, Gujarat, West India. We take a bottom-line approach to each project. Our clients consistently see increased traffic, enhanced brand loyalty and new leads thanks to our work. We'd like to think that we're the kind of people you can come to enjoy spending time with and be trusted to achieve your business objectives. Our Process that works for our business is consisting of six stages from concept to completion without unnecessary delays and cost overruns.
Company Services:
• Web Developing
• Web Development Services
• Graphics Design Services
• Internet Marketing
• Web Hosting Services
• Web Maintenance Services
• Software Developing and Testing
• IPhone and Android Development
• ERP Solutions
Hi,
What I understand is that you are trying to copy the code from a desktop application to a code behind of a web page. What happens in the desktop application is that you are running the application as owner so you can access the printer or do other priviliged tasks while for a web application that resides on a server (IIS) you dont get those priviliges.
Hope you get the explanation. I know about a solution. If you are interested then I can share the details or get it done for you
Regards,
Waqas
You have to use javascript print function.
1. whatever you want to print that is written into your page using div tag.
2. print the div tag.
Thank You.