Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

A4 size receipts print using Asp.NET , C#

Posted on 2010-08-26
5
Medium Priority
?
2,758 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

636 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