| 
	
		|  Autor | Tema: Duda acerca de imprimir (en impresora)  (Leído 2,911 veces) |  
	| 
			| 
					
						| Pieshna 
								
								 Desconectado 
								Mensajes: 6
								
								
								
								
								
								   | 
 
Hola buenos dias, tardes o noches... Queria saber si alguien me puede ayudar con un codigo para imprimir (con impresora) ya que he estado buscando pero no encuentro uno funcional para c++   Es para un proyecto final de programacion y solo me falta el que se pueda imprimir los datos, ayuda!  
 
 |  
						| 
								|  |  
								| « Última modificación:  6 Junio 2018, 20:01 pm por Pieshna » |  En línea | 
 
 |  |  |  | 
			| 
					
						| SrMcLister 
								
								 Desconectado 
								Mensajes: 35
								
								   | 
 
Buenas Pieshna.¿Podrías dar mas detalles? SO por ejemplo, marca de impresora, puerto al que está conectada...
 Un Saludo.
 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 return((u.areHappy() && u.knowIt()) ? u.clapYourHands() : u.goFuckYourself());
 |  |  |  | 
			| 
					
						| Pieshna 
								
								 Desconectado 
								Mensajes: 6
								
								
								
								
								
								   | 
 
Buenas Pieshna.¿Podrías dar mas detalles? SO por ejemplo, marca de impresora, puerto al que está conectada...
 Un Saludo.
 
 Hola, saludos SrMcLister Estoy usando Windows 10 y estoy programando con dev-c++, la impresora es canon (MP 280), puertos LPT1-3, USB002 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| ThunderCls 
								 
								
								 Desconectado 
								Mensajes: 455
								
								 
								Coder | Reverser | Gamer
								
								
								
								
								
								     | 
 
C++ no tiene soporte nativo para la impresion de documentos (al menos que yo sepa), la impresión está condicionada por el sistema operativo que uses, en este caso windows tiene sus drivers y un sistema de spooling, etc. Aqui tienes alguna informacionhttps://msdn.microsoft.com/en-us/library/windows/desktop/dd162861 (v=vs.85).aspxhttps://msdn.microsoft.com/en-us/library/windows/desktop/ff819270 (v=vs.85).aspx De cualquier forma necesitas usar las APIs que te brinda tu sistema operativo y hacer las llamadas desde tu codigo c++. He encontrado este codigo por ahi pero no se si funcionara del todo, igual te podria servir #include <stdio.h>#include <windows.h>#include <string.h> void printer(char text[]){ 	// Bring up a dialog to choose the printer	PRINTDLG pd = {0};	pd.lStructSize = sizeof( pd );	pd.Flags = PD_RETURNDEFAULT | PD_RETURNDC;	pd.nCopies=1; 	// Show the printer Dialog	PrintDlg( &pd );  	// Zero and then initialize the members of a DOCINFO structure.	DOCINFO di = {0};	di.cbSize = sizeof(DOCINFO);	di.lpszDocName = "Scribble Printout";	di.lpszOutput = (LPTSTR) NULL;	di.lpszDatatype = (LPTSTR) NULL;	di.fwType = 0; 	// Begin a print job by calling the StartDoc function.	StartDoc(pd.hDC, &di); 	// Inform the driver that the application is about to begin sending data.	StartPage(pd.hDC); 	//here we put images\text or other DC things;) 	//send some text	TextOut(pd.hDC,800,800,text, strlen(text));  	//Lets close  the printer	// Inform the driver that the page is finished.	EndPage(pd.hDC); 	// Inform the driver that document has ended.	EndDoc(pd.hDC);} int main () {	printer("Hello world");			return 0;}
 Igual puedes buscarte la vida con alguna libreria, estas por ejemplo:https://www.gtkmm.org/es/index.htmlhttps://developer.gnome.org/gtkmm-tutorial/unstable/sec-printing-example.html.en#sec-printing-example-simplehttps://www.codeproject.com/Articles/89/Printing-Class-Library Saludos y buena suerte |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| Pieshna 
								
								 Desconectado 
								Mensajes: 6
								
								
								
								
								
								   | 
 
C++ no tiene soporte nativo para la impresion de documentos (al menos que yo sepa), la impresión está condicionada por el sistema operativo que uses, en este caso windows tiene sus drivers y un sistema de spooling, etc. Aqui tienes alguna informacionhttps://msdn.microsoft.com/en-us/library/windows/desktop/dd162861 (v=vs.85).aspxhttps://msdn.microsoft.com/en-us/library/windows/desktop/ff819270 (v=vs.85).aspx De cualquier forma necesitas usar las APIs que te brinda tu sistema operativo y hacer las llamadas desde tu codigo c++. He encontrado este codigo por ahi pero no se si funcionara del todo, igual te podria servir #include <stdio.h>#include <windows.h>#include <string.h> void printer(char text[]){ 	// Bring up a dialog to choose the printer	PRINTDLG pd = {0};	pd.lStructSize = sizeof( pd );	pd.Flags = PD_RETURNDEFAULT | PD_RETURNDC;	pd.nCopies=1; 	// Show the printer Dialog	PrintDlg( &pd );  	// Zero and then initialize the members of a DOCINFO structure.	DOCINFO di = {0};	di.cbSize = sizeof(DOCINFO);	di.lpszDocName = "Scribble Printout";	di.lpszOutput = (LPTSTR) NULL;	di.lpszDatatype = (LPTSTR) NULL;	di.fwType = 0; 	// Begin a print job by calling the StartDoc function.	StartDoc(pd.hDC, &di); 	// Inform the driver that the application is about to begin sending data.	StartPage(pd.hDC); 	//here we put images\text or other DC things;) 	//send some text	TextOut(pd.hDC,800,800,text, strlen(text));  	//Lets close  the printer	// Inform the driver that the page is finished.	EndPage(pd.hDC); 	// Inform the driver that document has ended.	EndDoc(pd.hDC);} int main () {	printer("Hello world");			return 0;}
 Igual puedes buscarte la vida con alguna libreria, estas por ejemplo:https://www.gtkmm.org/es/index.htmlhttps://developer.gnome.org/gtkmm-tutorial/unstable/sec-printing-example.html.en#sec-printing-example-simplehttps://www.codeproject.com/Articles/89/Printing-Class-Library Saludos y buena suerteMuchas gracias lo probare y gracias también por los links con la información     |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | Imprimir colores CMYK EN IMPRESORA RGB Diseño Gráfico
 | wilkins | 7 | 9,649 |  9 Abril 2006, 07:53 am por _loko_
 |  
						|   |   | Error al imprimir con impresora en Red !!! AYUDA Redes
 | kniche1989 | 4 | 8,420 |  28 Diciembre 2011, 23:47 pm por kniche1989
 |  
						|   |   | DUDA Imprimir Tickets desde C# IMPRESORA FISCAL .NET (C#, VB.NET, ASP)
 | NetStorm | 1 | 14,141 |  10 Mayo 2012, 09:10 am por USLO
 |  
						|   |   | Imprimir en impresora ethernet Programación C/C++
 | soyloqbuskas | 0 | 2,683 |  18 Agosto 2012, 10:20 am por soyloqbuskas
 |  
						|   |   | [DUDA] Leer archivos que se van a imprimir(Impresora Física) Programación General
 | ReaverZ3r0 | 3 | 2,886 |  25 Enero 2017, 13:14 pm por ReaverZ3r0
 |    |