Solved

A4 size receipts print using Asp.NET , C#

Posted on 2010-08-26
5
2,444 Views
Last Modified: 2012-05-10
Hej Experts,
I am building a web portal using asp.net and C# and i need to print some receipts on A4 size page and two copies of same receipt I am assuming a UserControl displayed twice. But can someone please help about size of Div that should be chosen in pixels.
I have had some suggesions that i should be using pdf but i do not intend to buy any pdf tools etc. I also know that A4 sizes and pixels dont have any direct link but still there must be a way to achieve above.
Any link to some useful article or working example willl be great as i have used / wasted lot of time in this already :). Thanks in advanced.
0
Comment
Question by:hussainAbid
  • 2
  • 2
5 Comments
 
LVL 21

Expert Comment

by:Dale Burrell
ID: 33537436
Why use pixels? Using CSS specify the size in millimetres and as A4 is 210mm*297mm it will be exact. You may then run into problems with margins though... I'd probably make the control a bit smaller in height and force a CSS page-break between the 2 controls.
0
 

Author Comment

by:hussainAbid
ID: 33539384
Hej dale_burrel,

It looks like a way to go man. But can you pleasee come with a little example on this for syntax n more understanding purpose :). For example here is my plan now:

 i can choose the outer div size to be certain millimeters as u suggested and then drop contents in and see how it goes but thing is i need to print two receipts on One page. So service person will just tear it in half and give one to customer and keep half for record ( paper saving man Greenhouse thingy ;) ) so i need to ask what is concept of line-break in ur above answer and is this a workable plan ? :)

Looking forward to hear from you.

0
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 500 total points
ID: 33539413
Something like this should do the job
<style type="text/css"">
  .A4 {
    width:210mm; /* You willmay need to reduce this to handle printer margins */
    margin:auto; /* This means it will be centred */
    height:297mm; /* You willmay need to reduce this to handle printer margins */
  }
  .LineBreak {
    page-break-before:always;
    height:1mm;
    overflow:hidden;
  }
</style>

<div class="A4">Put the first copy of the receipt here.</div>
<div class="LineBreak"></div>
<div class="A4">Put the second copy of the receipt here.</div>

Open in new window

0
 
LVL 3

Expert Comment

by:raaziq
ID: 33539973
better use some reporting tools like REPORTING SERVICE. which is very easy to implement and size can be set without any issues
0
 

Author Closing Comment

by:hussainAbid
ID: 33540495
Thanks man :).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now