35 Commits
Author SHA1 Message Date
Frederik Carlier 831381caa9 Use CoreFX sources for System.Printing (#5041) 2017-06-16 00:57:02 +02:00
Marek Safar 47a6f56439 [bcl] Clean up some warnings 2016-11-29 19:16:02 +01:00
Paul Gofman bbf7ea470a [System.Drawing.Printing] CUPS default PageSize and InputSlot should override PPD defaults.
There is already a test case for that (PrintingServicesUnixTest.cs,
Bug602934_PrinterSettingsReturnActualValues) which fails when user
configured options are different from PPD settings. Patch also makes
this test not to fail if "Resolution" option is not present in CUPS
options.

*Update: removed leftover debug Console.WriteLine from patch
2016-02-19 13:01:10 +03:00
guerrysemones eefcd3b42e This is a patch to fix bug 34123. System.Drawing.Printing.PrintingServicesUnix is failing to print on Mac OSX Yosemite because the CUPS function cupsTempFile now always returns an empty string. This function was deprecated. Now replacing cupsTempFile call with call to cupsTempFd to fix printing. I do not see a clear way to unit test this, and there appear to be no prior unit tests covering this. Essentially we are swapping a function call for another that returns the same type of result. This was tested on my copy of net_4_x master. The same fix could be applied to mono version 3 also. This change is released under the MIT license. 2015-09-23 13:32:46 -05:00
Eberhard Beilharz 049a349dae [Printing] Improve reported printer settings (Fixes #602934)
Report the actual values of the printer driver in printer settings
instead of using hard coded default values. This fixes Novell bug
#602934 (https://bugzilla.novell.com/show_bug.cgi?id=602934).
2014-02-28 16:45:46 +01:00
Sebastien Pouliot b24dc833fc 2008-11-01 Sebastien Pouliot <[email protected]>
* PrintingServicesUnix.cs: Fix potential crash on 64bit OS. Gendarme
	rule for checking IntPtr has been updated to cover this case as well


svn path=/trunk/mcs/; revision=117611
2008-11-01 16:34:27 +00:00
Marek Safar b2d5552461 Warnings cleanup
svn path=/trunk/mcs/; revision=111848
2008-08-28 17:45:48 +00:00
Sebastien Pouliot cda1fa7d8d PrintingServicesUnix.cs: Fix AvoidToStringOnStringsRule found using Gendarme.
svn path=/trunk/mcs/; revision=95402
2008-02-10 20:21:47 +00:00
Sebastien Pouliot 52fc59a004 2007-05-23 Sebastien Pouliot <[email protected]>
* PreviewPrintController.cs: Reduce bitmap size and avoid scaling the
	print preview (fix bug #80765). Patch from Vladimir Dimitrov.
	* PrintingServicesUnix.cs: Reorder calculation to avoid loss of 
	precision in integer division. Use printer resolution for Cairo
	fallback. Patch from Vladimir Dimitrov.


svn path=/trunk/mcs/; revision=77837
2007-05-23 14:38:40 +00:00
Andreia Gaita 20bb09af74 2007-02-21 Andreia Gaita <[email protected]>
* PrintingServicesUnix.cs: Report an error in the console if there is
a problem opening the printer.

svn path=/trunk/mcs/; revision=73289
2007-02-22 00:24:29 +00:00
Andreia Gaita 4a6f551587 2007-02-21 Andreia Gaita <[email protected]>
* PrintingServicesUnix.cs: don't free up pointers unnecessarily (doh)

svn path=/trunk/mcs/; revision=73268
2007-02-21 18:42:53 +00:00
Andreia Gaita 142921787d 2007-02-21 Andreia Gaita <[email protected]>
* PrintingServicesUnix.cs: add checks and try blocks to make sure
things don't blow up if we try to double free anything (not that
we're trying to do anything like that :p )

svn path=/trunk/mcs/; revision=73264
2007-02-21 18:08:29 +00:00
Andreia Gaita 3dd97999d2 2007-02-20 Andreia Gaita <[email protected]>
* PrintingServicesUnix.cs: fix a double-free bug

svn path=/trunk/mcs/; revision=73263
2007-02-21 17:36:43 +00:00
Andreia Gaita 9cbe08c5c3 2007-02-20 Andreia Gaita <[email protected]>
* PrintingServicesUnix.cs: Fix leak caused by not calling cupsFreeDests
	on certain codepaths. Fix return value of cupsFreeDests to void.

svn path=/trunk/mcs/; revision=73208
2007-02-20 18:59:27 +00:00
Andreia Gaita 0b5d6119ab 2007-02-20 Andreia Gaita <[email protected]>
* PrintingServicesUnix.cs: Correct missing static initialization
of loaded printers hashtable, unit tests were failing (oops :p)

svn path=/trunk/mcs/; revision=73170
2007-02-20 14:07:27 +00:00
Andreia Gaita 7dda136e2b 2007-02-16 Andreia Gaita <[email protected]>
Redesign how and when cups gets called to minimize
p/invokes, implements caching of printers and printer
settings as per calberto's patch - #79822, plotter detection, 
duplex, fixes for image disposing, code modularization, 
misc. fixes.

svn path=/trunk/mcs/; revision=73048
2007-02-16 23:10:35 +00:00
Sebastien Pouliot 5ed9a98698 2007-02-09 Sebastien Pouliot <[email protected]>
* PrintingServicesUnix.cs: Ensure we free the original pointer in
	GetAlternativeDefaultPrinter (not the one used for iteration).


svn path=/trunk/mcs/; revision=72542
2007-02-09 14:19:48 +00:00
Andreia Gaita d41f32888e 2007-01-19 Andreia Gaita <[email protected]>
* PrintingServicesUnix.cs: Add is_default flag check for 
detecting default printer when cupsGetDefault doesn't return
valid values (mainly ubuntu). Fixes #80198, #80519

svn path=/trunk/mcs/; revision=71372
2007-01-19 22:41:06 +00:00
Carlos Alberto Cortez 37fa66d50b 2006-12-04 Carlos Alberto Cortez <[email protected]>
* PrintingServicesUnix.cs: Add "landscape" option
	when using PaperSettings.Landscape set to true. Also
	swap the width and height for the postscript file.


svn path=/trunk/mcs/; revision=69014
2006-12-05 05:57:20 +00:00
Andreia Gaita b3379e6e39 2006-12-02 Andreia Gaita <[email protected]>
* PrintingServicesUnix: Proper size structure use for 64 bit
support.

svn path=/trunk/mcs/; revision=68878
2006-12-02 18:13:29 +00:00
Andreia Gaita 4b9e949427 2006-12-01 Andreia Gaita <[email protected]>
* PrintingServicesUnix: *properly* check return value from 
cupsGetDefault. If there are no default printers set, 
check if there are installed printers, and use that.
Hopefully fixes #79835

svn path=/trunk/mcs/; revision=68872
2006-12-02 00:08:11 +00:00
Andreia Gaita b1dab8b8be Hopefully fixes #79835
* PrintingServicesUnix: check return value from cupsGetDefault.

2006-12-01  Andreia Gaita  <[email protected]>

	
	

svn path=/trunk/mcs/; revision=68864
2006-12-01 22:06:28 +00:00
Jordi Mas i Hernandez a80595c165 2006-11-25 Jordi Mas i Hernandez <[email protected]>
* PrintingServicesUnix.cs: Implements GetPrintDialogInfo


svn path=/trunk/mcs/; revision=68454
2006-11-25 10:36:07 +00:00
Carlos Alberto Cortez 5b33fc860a 2006-11-24 Carlos Alberto Cortez <[email protected]>
Initial support for PageSettings (color, copies, collate,
	and media size).

	* StandardPrintController.cs: Pass PrintDocument.PageSettings to
	create the Graphics object (althought PageSettings
	contains a PrinterSettings and vice versa, PrintDocument
	can contain non-related PrinterSettings and PageSettings objects).

	* PrintingServices.cs: Likewise.
	* PrintingServicesWin32.cs: Likewise.
	* PrintingServicesUnix.cs: Likewise. Also use cupsParseOptions
	to pass printing options when calling cupsPrintFile. Use "Custom"
	as name for custom pages without associated name (Laxmark printers
	have this problem, causing a nullref exc). Add GetPaperKind () method
	to retrieve and set the right PaperKind value for PaperSize, instead
	of using PaperKind.Custom for all page sizes. Finally save
	PageSettings in DOCINFO to use it later.

	* PrintDocument.cs: Clone PrinterSettings.PageSettings
	instead of creating a new one (this avoid creating an additional
	PrinterSettings instance).


svn path=/trunk/mcs/; revision=68449
2006-11-25 02:20:27 +00:00
Andreia Gaita 360de1202f Fixes #79835, implements PrinterSettings.IsValid, throws proper
InvalidPrinterException with differentiated messages.

* PrintingServices.cs: Declares IsPrinterValid to enable easy checking
if printer name is a valid printer

* PrintingServicesWin32.cs: Implements IsPrinterValid, caches 
last assigned printer name and if it is valid to speed up next calls.

* PrintingServicesUnix.cs: Implements IsPrinterValid, caches 
last assigned printer name and if it is valid to speed up next calls.

* PageSettings.cs: 
	- throw InvalidPrinterException in the properties,
	according to the docs: Color, Landscape, PaperSize, PaperSource, 
	PrinterResolution
	- change the private fields above to internal, so that in the
	constructor we can access them without triggering the exceptions
	if there are no printers installed
	
* PrinterSettings.cs: Implement IsValid to call IsPrinterValid
implemented above

* PreviewPrintController.cs: throw InvalidPrinterException on 
StartPrint() if there's no valid printer configured

* InvalidPrinterException.cs: New private GetMessage() to customize
printer error message, used by constructor

2006-11-14 Andreia Gaita <[email protected]>

svn path=/trunk/mcs/; revision=67880
2006-11-14 23:03:43 +00:00
Jordi Mas i Hernandez 99eceeb81b * PrintingServicesUnix.cs: Implements LoadPrinterPaperSources member,
simplifies GetPaperSizeName and loads paper source and size defaults

2006-09-27 Jordi Mas i Hernandez <[email protected]>


svn path=/trunk/mcs/; revision=65976
2006-09-27 17:26:59 +00:00
Jordi Mas i Hernandez 466bc86721 2006-09-27 Jordi Mas i Hernandez <[email protected]>
* PrintingServices.cs: Add LoadPrinterPaperSources member
	
	* PrintingServicesWin32.cs: Implements LoadPrinterPaperSources and
	reads the default paper source and size.
	
	* PrintingServicesUnix.cs: Add stub LoadPrinterPaperSources member
	
	* PrinterSettings.cs: Implements PaperSourceCollection property and
	makes default paper source and size from the system.


svn path=/trunk/mcs/; revision=65968
2006-09-27 12:07:06 +00:00
Chris Toshok b566a6548d 2006-07-26 Chris Toshok <[email protected]>
* PrinterSettings.cs: expose PrintFileName in the 1.1 case as an
	internal property, so we can get at it from MWF.

	* PrintingServicesUnix.cs: handle print to file, and also remove
	the temp file after sending the data to the printer.  fix some
	dllimports to match the rest of system.drawing.

	* PreviewPrintController.cs: implement this (warning, it'll eat
	all your memory until we get a real Metafile implementation, as
	we're storing bitmaps).

	* PrintDocument.cs: shift the graphics context stuff around a bit
	in Print(), so that the events after OnStartPrint are passed the
	graphics context the controller created there, and we use the
	return value of OnStartPage to do all drawing.


svn path=/trunk/mcs/; revision=63020
2006-07-26 23:02:29 +00:00
Jordi Mas i Hernandez f36b05098c 2006-05-20 Jordi Mas i Hernandez <[email protected]>
* PrintingServices.cs: GetPrintDialogInfo definition
	* PrintingServicesWin32.cs GetPrintDialogInfo implementation
	* PrintingServicesUnix.cs: GetPrintDialogInfo stub


svn path=/trunk/mcs/; revision=60889
2006-05-20 15:58:22 +00:00
Jordi Mas i Hernandez 9fd6cbc11f 2006-04-14 Jordi Mas i Hernandez <[email protected]>
* PrintingServicesUnix.cs: Replace cupsGetPrinters deprecated API call


svn path=/trunk/mcs/; revision=60683
2006-05-14 09:20:50 +00:00
Jordi Mas i Hernandez 48e7e27ab1 2006-04-13 Jordi Mas i Hernandez <[email protected]>
* PrintingServicesUnix.cs: Checks if cups is installed
	* PrinterSettings.cs: PrintToFile property and ToString method


svn path=/trunk/mcs/; revision=60679
2006-05-13 18:18:36 +00:00
Sebastien Pouliot a91b0dc4ef 2006-03-21 Sebastien Pouliot <[email protected]>
* PrintingServicesUnix.cs: cupsGetPrinters(char***) requires to free 
	each individual string and (finally) the list. Note that this call is
	deprecated.


svn path=/trunk/mcs/; revision=58270
2006-03-22 00:00:06 +00:00
Peter Dennis Bartok 6bfdefe3d7 2006-03-13 Peter Dennis Bartok <[email protected]>
* PrintingServicesUnix.cs: Handle not having a printer


svn path=/trunk/mcs/; revision=57931
2006-03-14 00:10:10 +00:00
Jordi Mas i Hernandez 3e3aff3acb 2006-01-15 Jordi Mas i Hernandez <[email protected]>
* PrintingServicesUnix.cs: Allow setting the dpy's for the surface


svn path=/trunk/mcs/; revision=55609
2006-01-15 21:20:28 +00:00
Jordi Mas i Hernandez 08351b8c0d 2005-12-22 Jordi Mas i Hernandez <[email protected]>
* PrintingServices.cs: Printing services abstration class
	* PrintingServicesWin32.cs: Win32 printer driver
	* PrintingServicesUnix.cs: Unix printer driver
	* Margins.cs: Fixes exceptions error messages
	* PrinterResolution.cs: Fixes
	* PrintEventArgs.cs: New internal method
	* PrintPageEventArgs.cs: New internal method
	* StandardPrintController.cs: Fixes
	* PrinterUnitConvert.cs: Fixes conversion errors
	* PrintDocument.cs: Fixes to make it print
	* PageSettings.cs: Take margains into account
	* PrintController.cs: Fixes
	* PaperSize.cs: Method to set paper Kind
	* PrinterSettings.cs: Implements settings and fixes
	* 	


svn path=/trunk/mcs/; revision=54735
2005-12-22 17:06:00 +00:00