Solved

A4 size receipts print using Asp.NET , C#

Posted on 2010-08-26
5
2,558 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

735 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