Solved

A4 size receipts print using Asp.NET , C#

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

760 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

21 Experts available now in Live!

Get 1:1 Help Now