Margins

I have created a program that runs a report of the company's daily sales.
The problem I am having is that the text prints to close to the top and bottom of the page. Is there a way to write code to add extra margins to the top and the bottom?
You're being very vague in your question. Are you talking about standard console output, or something like a Word document getting output? There's no such thing as a "page" if we're just talking about basic console I/O.

Anyway, if you're referring to console output (std::cout), have you tried just adding more newlines before the message?
1
2
3
std::cout << '\n';
std::cout << message << etc << '\n';
std::cout << '\n';
Ganado,
Thanks for the reply and I apologize for being vague. By "page" I am referring to the actual printed peace of paper that comes from the printer itself.
That's what I was afraid of. Sorry, but that has nothing to do with programming. If you're on windows, cmd doesn't even let you print directly from it...

Copy your output into an actual text processor like Microsoft Word or OpenOffice Writer, and then you can adjust the margins of your paper however you please.
That's kind of what I thought.
Thanks Ganado
does this still work?
https://superuser.com/questions/477895/printing-from-windows-7-command-line

its terribly clunky, but it worked up thru win 7, I have not tried it in a long time but it used to be possible to print text files directly to the printer and probably still is.

a company's daily sales, if this is real and not homework, you may want to wrap the text in simple HTML tags to format the font size/position/etc and such to make a nice looking output, redirect the console output to .html file, open that, and print it from the browser. Should give a very nice result for not much effort (a win / win situation).

as far as console output, you can add empty lines at the top and bottom of 'pages', just cout << endl as needed.

if you did not know,
programname > file
at the command prompt will dump the output to a text file that you can open in anything.
Last edited on
jonnin,
Thanks for the reply.
lol. homework... Nope not homework. I'm 50 years old and graduated from college last year. Now that i'm in the workforce starting my new career, i'm finding that they don't really teach you that much in school. smh.
If you use Windows have a look here:
https://www.dreamincode.net/forums/topic/194320-win32-api-printer-tutorial-using-gdi-functions/

Though the tutorial uses a GUI it should work with a console app as well.
Topic archived. No new replies allowed.