Solved

A4 size receipts print using Asp.NET , C#

Posted on 2010-08-26
5
2,588 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

738 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