printing

Retrieving Device Context from .NET print API

▼魔方 西西 提交于 2019-12-13 01:24:40
问题 I am working on a .NET application to control DataCard Desktop Card printers, and I have stumbled upon a problem. In order to execute Magnetic Stripe and Chip encoding, I have to call a function in a native printer API dll to enable the printers Interactive mode. I have managed to create the P/Invoke code to call this native function. But the problem is that this method takes the printer Device Context handle as a parameter, and have to be called BEFORE the Gdi32 StartDoc function is called.

In python carriage return \r returns a musical note

点点圈 提交于 2019-12-13 00:45:25
问题 print "-------------------\r" produces a musical note instead doing the carriage return. Why? Thanks in advance for reply. EDIT: I was using it in this code in order to change dinamically data by 'print' instead to re-print it all: import math import time while True: reading = read_world_2c(0x43) #it's a function for reading data from a sensor print "data: \r", reading time.sleep(0.5) 回答1: That musical note is the symbol for line breaks. If you have MS Word or Notepad++ or similar, open or

Perl print function adding unwanted newlines to variables

安稳与你 提交于 2019-12-13 00:33:20
问题 I thought this would be simple enough. I have two arrays, and I want to print a sentence with numbers from these arrays into a file. I tried this: chomp $array1[$x]; chomp $array2[$x]; print FILE "Number1: $array1[$x] \& Number2: $array2[$x] Some Words\n"; Which gives me: Number1: 0 & Number2: 87.3 Some Words (Numbers here are just examples.) Any idea why this is happening? I've tried using $array1[$x] =~ s/\n//g; $array2[$x] =~ s/\n//g; as well, but it hasn't fixed anything. Also, if I

What do I need to look into to fix this printing issue

自闭症网瘾萝莉.ら 提交于 2019-12-13 00:27:01
问题 The problem I am facing is that my code works when I run as me but doesn't work when I run as a domain account. I'm opening an .mht file from a file location and tring to print it. Opening the file works and it displays the page fine but printing it doesn't work. Heres my code so far: Dim ie As SHDocVw.InternetExplorerMedium = New SHDocVw.InternetExplorerMedium AddHandler ie.PrintTemplateTeardown, AddressOf PrintedCB AddHandler ie.DocumentComplete, AddressOf LoadedCB ie.Visible = True

Java Exception printing twice

寵の児 提交于 2019-12-13 00:26:41
问题 I know the exception is kind of pointless, but I was trying to learn how to use / create exceptions so I used this. The only problem is for some reason my error message generated by my exception is printing to console twice. import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner; public class Project3 { public static void main(String[] args) { try { String inputFileName = null; if (args.length > 0) inputFileName = args[0]; File

Why do I need to call Dispatcher.BeginInvoke() to allow a visual to properly bind before printing?

流过昼夜 提交于 2019-12-12 21:46:28
问题 I have a UserControl with a fixed size of 850x1100 to give me the same aspect ratio as a letter-sized piece of paper. I display this in my window inside a Viewbox , and it acts much like a print preview. The control inherits my window's DataContext, and when it's displayed on the screen, all the bindings work and it looks wonderful. I've written the code below in my window's code behind (I feel it's a totally view-oriented operation) to attempt to print it. If I execute this code as written,

PrintQueueStatus returns None, printer is already turned off

与世无争的帅哥 提交于 2019-12-12 20:49:32
问题 I already turned off the printer, and my code still returns None Here is my code try { printServer.Refresh(); PrintQueue printQueue = new PrintQueue(printServer, cmbPrinters.Text.Trim()); printQueue.Refresh(); if (printQueue.QueueStatus == PrintQueueStatus.Offline) { MessageBox.Show("Offline"); } else if (printQueue.QueueStatus == PrintQueueStatus.None) { MessageBox.Show("None"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } I am expecting that it should return offline because I

Python: literally “printing” a function

眉间皱痕 提交于 2019-12-12 20:14:16
问题 For reasons I won't get into, I need some way to literally print a function. I know when you run print on a function object you get some complicated <010101045 function> output. So to my understanding perhaps the only way to do this is run some kind of python notepad module. Then I could devise an algorithm to write a line of text to match each function line so as to get a printed function. If anyone knows some other way to achieve this, please do tell because I am sure doing it this way is

Print Wesite to PDF using VBA

删除回忆录丶 提交于 2019-12-12 19:16:10
问题 I am trying to save HTML as PDF using VBA. I don't know how to check what is the default printer change it to Microsoft Print to PDF and then back to the old printer. Below is my code: I search something on Google, then enter the links on the first Google Search page and then I would like to print searches to PDF. Sub Main() Dim search As String Dim save_path As String Dim number As Integer number = 5 save_path = "" Dim query As String query = InputBox("Enter here your search", "Google Search

IE Print font size smaller

↘锁芯ラ 提交于 2019-12-12 18:36:47
问题 I am printing my page from IE using javascript print function. The text is way smaller than what it should be. function BtnPrintClick() { var printHTML = $('#divPrint').html(); window.innerHTML = ""; window.innerHTML = printHTML; window.print(); This is my script. Why does it not pick up the font size of the web page? The font is not being resized in any @media print styling. I am using IE9. 回答1: When you print a webpage, Internet Explorer shrinks the content of the webpage to fit the width