printing

going through a dictionary and printing its values in sequence

def display_hand(hand): for letter in hand.keys(): for j in range(hand[letter]): print letter, Will return something like: b e h q u w x. This is the desired output. How can I modify this code to get the output only when the funtion has finished its loops? Something like below code causes me problems as I can...

Print only twelve characters from user submitted string in Java

I have a user input their name as a string and then the name is printed out onto the screen. How can i limit what is printed to only 12 characters so that a user cannot type an insanely long name? Here is my code: Scanner input = new Scanner(System.in); System.out.print("Enter your player name: "); String name= input.next();...

Programmatically changing the destination printer for a WinForms WebBrowser control

I'm trying to use an invisible WebBrowser control to print a very simple HTML document. Our application requires that we be able to print several documents this way, and that they all can be sent to different printers. Unfortunately, I haven't been very successful in making the output go to the right printer. The way it works right now...

Print MSWord-Document with com4j

I'm trying to print out a .doc-File with com4j. This is my Code: document.printOut2000(true, false, WdPrintOutRange.wdPrintAllDocument, newDocumentPath, _, _, WdPrintOutItem.wdPrintDocumentContent, 1, _, WdPrintOutPages.wdPrintAllPages, true, true, _, false, 0, 0, 0, 0); I got the values from a recorded Word-Macro and http://msdn.mic...

Why does silverlight run into an endless loop when printing document longer than 1 page? .HasMorePages = true

Hi. My 1st question here on stackoverflow. I am trying to print a long grid, which was dynamically generated. pdoc.PrintPage += (p, args) => { args.PageVisual = myGrid; args.HasMorePages = false; }; When I use args.HasMorePages = false;, it prints the first page of the grid as it should (althoug...

C++ Program Apparently Printing Memory Address instead of Array

#include <iostream> using namespace std; int main(){ int findMax(int *); const int MAX = 100; int values[MAX]; char ivals[256]; // Get the space-separated values from user input. cin.getline(ivals, 256, '0'); char *helper; // Clean input array and transfer it to values. for(int i = 0; i < (MAX) && iv...

VS2010 ASP.NET ReportViewer Control Print as Zoom

I have a RDLC report displayed in the ReportViewer and then set the zoom to 10%. The report resizes to 10%. When I print or export the report it is full size again. Is there a way to make the zoom effect the export and print or is it merely for display in the browser? Thanks, ...

how to print a QGraphicsScene that has text and graphics

I have a QGraphicsScene that has graphics as well as text drawn on it. When I try to print, the graphics are fine, but the text is using a font size defined in points, so scene->render() when I pass it a QPainter initialized with a QPrinter, has VERY large text. How am I supposed to print a QGraphicsScene that has text on it? edit: H...

Can the print() command in R be quieted?

In R some functions can print information and return values, can the print be silenced? For example: print.and.return <- function() { print("foo") return("bar") } returns > print.and.return() [1] "foo" [1] "bar" > I can store the return like: > z <- print.and.return() [1] "foo" > z [1] "bar" > Can I suppress the print o...

Make Python bool print 'On' or 'Off' rather than 'True' or 'False'

What is the best way to make a variable that works exactly like a bool but prints On or Off rather than True or False? Currently the program is printing: Color: True, whereas Color: On would make more sense. For the record, I initially tried to make an OnOff class that inherits from bool: class OnOff(bool): def __str__(self): ...

Java -Check if file is in print Queue / In Use

Hey SO OK I have a program that: Creates a temporary file based on a users input Prints the File(Optional) Deletes the File (Optional) My problem sits between stages 2&3, I need to wait for the file to finish printing until I can delete it. FYI: the printing will take 5-10 minutes (large file to spool on an old computer) So I nee...

How to print using the IWebBrowserApp ??

Hi, I'm using IWebBrowserApp to open up a URL in Interenet Explorer in ma console application. Now I also need to print the content in the Internet Explorer through my code in C#. Can any1 pls help m eout. Thank you. ...

print colorful string out to console with python

Is there a way to print string in colorful way with python? For example, can I print some part of string red or something to a console? I use Mac OS X. ...

Print HTML in C#. Done.

I struggled for a long time how to print an HTML page in C#. Here's the Holy Grail. Taking advantage of StaTaskScheduler (taken from Parallel Extension Extras (link text)). Features: waits for the printing completion, hopefully reliable Limitations: requires C# 4.0, uses default printer, doesn't allow to change print template Tas...

printing selection of JTable

I want to print only selected rows in a JTable. My approach is to make a new TableModel, copy the selected rows there, add the tableModel to a new JTable and then print this new Table. My Problem: It doesnt work as expected, I just see a black line with the height of the rows, if i select lesser rows the line is smaller) but no content. ...

How can I get the total number of pages to be printed?

This is the basic printing program example from the Sun tutorial: PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(new HelloWorldPrinter()); boolean doPrint = job.printDialog(); if (doPrint) { try { job.print(); } catch (PrinterException e) { /* The job did not successfully complete */ } } When...

Reading and writting DEVMODE.dmColor

Hi I'm having trouble with the dmColor field fo the DEVMODE structure. My default printer is a color printer, if I default output color of the printer properties through the control panel to black and white the DEVMODE.dmColor field always returns DMCOLOR_COLOR instead of DMCOLOR_MONOCHROME. Even if I default my printer to a black a...

PrintJob printing background colour only

Hi Everybody, Hopefully someone can see something which I've missed out or something, because this is really odd! Basically I've created a print class which has all the print job code in to print a sprite, however when I print it, the sprite which I've created acts like a mask and the area where the sprite graphic should be is filled wi...

Safari 5 don't print jpg images in Windows

When I try to print jpg images in Safari (Windows) it print a blank page. Even if I open the JPEG directly in the browser, it prints nothing. Any solutions are welcome. ...

PHP is very slow when printing a large amount of information

I have an application where I need to retrieve a large amount of rows from the database and then print them all on the screen. I've checked the mysql queries, and that's not where the problem is. The problem is the rows all need to be printed on the same page, with no pagination, and it takes a long time (I'm talking about a table with s...