printdocument

How to print to network printer through application hosted in IIS

主宰稳场 提交于 2019-12-12 02:32:33
问题 I have scenario of printing pdf (generated from stream) to network printer through application hosted in IIS. I tried with PrintDocument.Print() and problem I'm facing is: 1. Document is getting queued to the print job queue with size 0 bytes. 2. Document is getting queued to the print job queue with owner name as machine_name. Here is the code which i tried using PdfiumViewer (to generate PrintDocument from bytearray) and System.Drawing.Printing.PrintDocument: public void SendPdfToPrinter

Increasing paper height per iteration using printdocument

血红的双手。 提交于 2019-12-11 18:29:31
问题 i m using printdocument for a printout. i want to increment the size of the paper after each row is added. I found a similar question here and here. But the solution doesnot work. I m using a Component class to override the base method of Printdocument and I m setting the page size in OnBeginPrint event int pageHt = 288, pageWt = 314; protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e) { // Run base code base.OnBeginPrint(e); base.DefaultPageSettings.PaperSize = new

PrintDocument.Print is slow unless user is logged in to the printing computer

有些话、适合烂在心里 提交于 2019-12-11 05:59:25
问题 I have a web application hosted on server 'A' (SA) and a web service for printing hosted on server 'B' (SB). SA creates and image that needs printing and sends it to SB. When doing this, printing is fairly slow, around fifteen seconds. However, if I log into SB using remote desktop as the user from the webconfig of the app hosted on SA, then it will print in less than two seconds. It seems as if SB is starting something up when I log into it that is making it print faster. Any idea what this

How to display all documents in Couchdb using Python

非 Y 不嫁゛ 提交于 2019-12-11 02:47:13
问题 I have recently started using Python. I have a database called student in Couchdb. I have attributes in it like [english, maths, science, total, percentage]. I want to display all the documents from my student database using python. I cant access all the documents. I tried following code but didnt work couch = couchdb.Server() db = couch['student'] rows = db.view('_all_docs', include_docs=True) for row in rows: doc = db.get(row) print(doc['english']) 回答1: import couchdb couch = couchdb.Server

Choosing Correct papersize when printing with .NET PrintDocument

会有一股神秘感。 提交于 2019-12-10 18:08:17
问题 When I am looping through each page I need to decide the size of a page and choose what size to print it in. is there an easy way to determine what size they are suppose to be? right now i was going by the ratio of width and height. If ratio >= 1.64 && ratio <= 1.65 Then Legal Size, If ratio >= 1.29 && ratio <= 1.30 The Letter Size. but how about if they are printing other sizes do i have to do this for each one? 回答1: There are several different things that can be considered the "size of a

Is there a better way to get the page count from a PrintDocument than this?

此生再无相见时 提交于 2019-12-09 03:05:49
问题 This is the best I've come up with: public static int GetPageCount( PrintDocument printDocument ) { printDocument.PrinterSettings.PrintFileName = Path.GetTempFileName(); printDocument.PrinterSettings.PrintToFile = true; int count = 0; printDocument.PrintController = new StandardPrintController(); printDocument.PrintPage += (sender, e) => count++; printDocument.Print(); File.Delete( printDocument.PrinterSettings.PrintFileName ); return count; } Is there a better way to do this? (This is

Drawing and Printing complex document in C# (improving/replacing my PrintDocument)

好久不见. 提交于 2019-12-08 02:06:01
问题 I am trying to produce a document in C# mainly to print. Basically it is a form, where I will fill in the values from objects from a database. The code I been using in the past is ugly, long, a pain to write and worse to maintain. public class MyDoc : PrintDocument { private MyContainer _myObject; //Inherits from list. private int PageCount() { return (int)Math.Ceiling(_myObject.Count / 5f); } protected override void OnPrintPage(PrintPageEventArgs e) { Graphics g = e.Graphics; g.PageUnit =

vb.net 2010 PrintDocument Margins not working even if I set the margins

半腔热情 提交于 2019-12-06 11:32:22
I am reading from a text file and then printing the string using printdocument via vb.net 2010. Here is my code : Public Class myPrinter Friend TextToBePrinted As String Public Sub prt(ByVal text As String) Dim psize As New System.Drawing.Printing.PaperSize("Custom Paper Size", 850, 550) Dim newMargins As New System.Drawing.Printing.Margins(0, 0, 0, 0) TextToBePrinted = text Dim prn As New Printing.PrintDocument Using (prn) prn.PrinterSettings.PrinterName = frmStockOut.printer prn.PrinterSettings.Copies = frmStockOut.copies prn.PrinterSettings.DefaultPageSettings.PaperSize = psize prn

Drawing and Printing complex document in C# (improving/replacing my PrintDocument)

孤人 提交于 2019-12-06 11:10:39
I am trying to produce a document in C# mainly to print. Basically it is a form, where I will fill in the values from objects from a database. The code I been using in the past is ugly, long, a pain to write and worse to maintain. public class MyDoc : PrintDocument { private MyContainer _myObject; //Inherits from list. private int PageCount() { return (int)Math.Ceiling(_myObject.Count / 5f); } protected override void OnPrintPage(PrintPageEventArgs e) { Graphics g = e.Graphics; g.PageUnit = GraphicsUnit.Millimeter; Font bigFont = new Font("Arial", 16, FontStyle.Regular, GraphicsUnit.Point);

how to set to default printer

你。 提交于 2019-12-04 05:00:55
How do you set PrintDocument.PrinterSettings.PrinterName to be the default printer? I am not talking about setting the default printer in the operating system. Rather, I am talking about setting the PrintDocument object so that it prints to the default printer. BenSwayne If I'm understanding correctly, you would like to be able to reset the PrinterName to the default printer (1) without recreating your PrintDocument and, (2) after you may have already set it to something else or, (3) when the default printer may have changed since the time when the PrintDocument was first created (so you can't