printing

Why PrinterState always returns null?

天大地大妈咪最大 提交于 2020-01-17 04:37:06
问题 I'm not to be able to get the PrinterState of my Printers. I have tested the following code on Linux and on Windows (7) with different Printers (Samsung, Brother (only on Linux), Zebra, ...). But in every case the PrinterState and the PrinterStateReasons objects are null. private void dumpPrinterState() { PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); //get printers for (PrintService printService : printServices) { log.info("---- printer: " + printService);

JavaFX Printable to Image very pix-elated, but perfect to printer

梦想与她 提交于 2020-01-17 03:56:05
问题 I have a printable object that prints perfectly fine to a printer, but when i print it to an Image, then it is very pixelated? Here is my code to setup a printer for printing and to an image private PageFormat setupPrinter() { // sizing (standard is 72dpi, so multiple inches by this) Double height = 4d * 72d; Double width = 3d * 72d; Double margin = 0.1d * 72d; // now lets print it AttributeSet attributes = new HashAttributeSet(); attributes.add(new Copies(1)); PrinterJob printJob =

Problem with TdxComponentPrinter (Delphi)

主宰稳场 提交于 2020-01-17 02:41:29
问题 TdxComponentPrinter is a componenet that allow me print a TPanel on a paper. But there is problem and when the panel contains TImage, the background of the image will be converted to black in the paper. Before print : After print (on the paper) : I have tried different ways to solve this problem. for example i used Repaint; method of TPanel,... but doesn't work and the background of image is still black. I don't know why!!! Help me please. 回答1: This is a png file, which might not be supported

Can I use special characters like tabulations and newlines in Show?

喜你入骨 提交于 2020-01-16 17:35:50
问题 data Pair = P Int Int instance Show Pair where show (P n1 n2) = (show n1) ++ "\t" ++ (show n2) Result: GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help \Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling Main ( labn.hs, interpreted ) Ok, modules loaded: Main. *Main> show (P 5 6) "5\t6" OK for a pair of ints this might be an artificial problem, but my actual use case is

Can I use special characters like tabulations and newlines in Show?

我是研究僧i 提交于 2020-01-16 17:35:07
问题 data Pair = P Int Int instance Show Pair where show (P n1 n2) = (show n1) ++ "\t" ++ (show n2) Result: GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help \Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling Main ( labn.hs, interpreted ) Ok, modules loaded: Main. *Main> show (P 5 6) "5\t6" OK for a pair of ints this might be an artificial problem, but my actual use case is

Need to improve resolution of screenshot from OpenGL

旧城冷巷雨未停 提交于 2020-01-16 13:18:33
问题 I want to get a screen shot from current scene in OpenTK with good resolution. I am using GL.ReadPixels to get a photo for the scene.If I save the photo to disk; I found it with low resolution/quality. following C# code is used to get a photo for the scene : Bitmap bmp = null; if (GraphicsContext.CurrentContext != null) { glControl_window.Invalidate(); int w = glControl_window.ClientSize.Width; int h = glControl_window.ClientSize.Height; bmp = new Bitmap(w, h); System.Drawing.Imaging

Access variables defined in a function in Python

不羁的心 提交于 2020-01-16 11:26:11
问题 I am defining an ipywidget button with the objective to run a function when the user clicks on it: import ipywidgets as widgets Button = widgets.Button(description='Search', disabled=False, button_style='info', tooltip='Search') display(Button) def whenclick(b): if catalogue.selected_index+1 ==2: dfS2 = pd.DataFrame({'Name': nameS2}) print(dfS2) Button.on_click(whenclick) Where nameS2 is: ['S2A_MSIL2A_20191205T110431_N0213_R094_T30TVK_20191205T123107.zip', 'S2B_MSIL2A_20191203T111329_N0213

Python: print doesn't work, script hangs endlessly

对着背影说爱祢 提交于 2020-01-16 05:26:16
问题 Using Python 2.6, I wrote a script in Windows XP. The script does the following: Input: Domain name (ie: amazon.com) The script queries DNS via the dnspython module and returns any A record IP Addresses. The output is in a special format needed for a specific application which utilizes this data. This works fine in Windows, but when I've placed this on my Linux server, I'm getting some unusual and inconsistent results. When run for the first time, it completes as expected. If I run it again

C# Printing with Font Styles

陌路散爱 提交于 2020-01-16 04:49:05
问题 I want to print some text like this. This is how i want to print the text. the code i am using is private void button3_Click(object sender, EventArgs e) { stringToPrint = "This is how i want to print the text"; printFont = new Font("Times New Roman", 10); pd.PrintPage += new PrintPageEventHandler(pd_PrintPage); try { pd.Print(); } catch (Exception e) { } } void pd_PrintPage(object sender, PrintPageEventArgs ev) { int charactersOnPage = 0; int linesPerPage = 0; ev.Graphics.MeasureString

Qt QPrinter setPaperSize does not work properly

自闭症网瘾萝莉.ら 提交于 2020-01-16 01:15:07
问题 I am trying to create a Windows application (but will eventually port it to linux also, so cross-compatibility is important if possible) that will take a picture from a webcam and can print without using a printDialog box, but I am having an issue selecting a paper size. I would like the paper size to be set to 4" x 6" which is the A6 format, but when I use setPaperSize(QtPrinter::A6) it seems to default to the letter format. It does not always default to letter with all printers though, it