Imprimir archivo PDF

Post Reply
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Imprimir archivo PDF

Post by Bayron »

Existe alguna forma de abrir un archivo PDF e imprimirlo nativamente desde FiveWin, y si la hay, desde que version de FWH puede usarse???
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Imprimir archivo PDF

Post by Bayron »

Tomando lo siguiente de Adobe Developer FAQ:

Code: Select all | Expand

AcroRd32.exe /t path "printername" "drivername" "portname"
Initiates Adobe Reader and prints a file, whose path must be fully specified, while
suppressing the Print dialog box.

The four parameters of the /t option evaluate to path, printername, drivername,
and portname (all strings).

● printername — The name of your printer.
● drivername — Your printer driver’s name, as it appears in your printer’s properties.
● portname — The printer’s port. portname cannot contain any "/" characters; if it
   does, output is routed to the default port for that printer.
 


Con el comando WaitRun(), podria imprimirse el archivo PDF, pero como le pasaria el String con toda esta Info???
Se necesita encontrar:
Nombre de la impresora default .... ?? GetDefaultPrinter()
Nombre del puerto.... ?? PrnGetPort()
Driver... ?? ???????
Path .... ?? Deberia ser el nombre completo del archivo...

Esto nos ayudaria a todos para no tener que usar programas externos para poder imprimir.... a menos que se pueda imprimir de forma nativa?????
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Patricio Avalos Aguirre
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile
Contact:

Re: Imprimir archivo PDF

Post by Patricio Avalos Aguirre »

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Imprimir archivo PDF

Post by Bayron »

Gracias Patricio,

Ya habia hecho algunas busquedas y habia encontrado ese link, el asunto es que yo ya utilizo el pdftk, y no quiero depender de un sin numero de utilitarios....

Por lo que puedes ver en la ayuda de Acrobat que posteé arriba, hay una manera para utilizar el mismo Acrobat Reader para hecer la impresión, y es ahi a donde yo quiero llegar...

Lo que realmente necesito es ayuda para encontrar los parametros que el Acrobat necesita para imprimir...

Te agradezco el link, y es así como podemos colocar todas las opciones que tenemos en estos POST's, asi quedan para futuras referencias....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Imprimir archivo PDF

Post by Bayron »

Usando SumatraPDF, el comando quedaría asi:

Code: Select all | Expand

  WaitRun( 'sumatraPDF -print-to-default -exit-on-print "salida.pdf"',0 )
 

Muy facil de usar, pero realmente me gustaria no tener que usar los mas de 4MB que utiliza el .EXE de SumatraPDF

Usando Activex:

Code: Select all | Expand

oActiveX = TActiveX():New( oWnd, "AcroPDF.PDF.1" , 1, 1, 20, 50 )

oWnd:oClient = oActiveX

oActiveX : Do( "LoadFile", "salida.pdf" )

oActiveX : Do( "SetCurrentPage", 1 )

oActiveX : Do( "PrintAll" )
 

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/iac_api_reference.pdf

El problema aqui, es que el archivo debe de estar cargado y si hay alguna configuracion de seguridad activada, simplemente no funcionaria...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Imprimir archivo PDF

Post by Daniel Garcia-Gil »

Bayron

Espero esto te pueda servir (usando WMI)

utilice estas 2 clases
http://msdn.microsoft.com/en-us/library/aa394363(v=VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa394366(v=VS.85).aspx

hay que buscar enlazar el driver con la impresora por default...

Code: Select all | Expand

#Include "FiveWin.ch"
//-----------------------//
Function Main()

    Local oLoc,oWmi,oList,oItem
    local aPrinter := {}
    local aDriver := {}

    oLoc:= CreateObject( "wbemScripting.SwbemLocator" )
    oWmi:= oLoc:ConnectServer()
   
    If oWmi == NIL
        ? "Sorry!! No Wmi"
        Return
    Endif
   
    oList := oWmi:ExecQuery("Select Name, PortName from Win32_Printer where default=1")
   
   
    FOR EACH oItem IN oList    
        AAdd( aPrinter, {oItem:Name, oItem:PortName} ) // lista de impresoras    
    Next
   
    xbrowse( aPrinter )
   
    oList := oWmi:ExecQuery("Select * from Win32_PrinterDriver")

    FOR EACH oItem IN oList    
        AAdd( aDriver, oItem:name ) // lista de impresoras    
    Next
   
    xbrowse( aDriver )

   oList = NIL
   oWmi  = NIL
   oLoc  = NIL
   

Return NIL  


hay informacion mas detallada de todas las clases aqui

http://msdn.microsoft.com/en-us/library/aa394084(v=VS.85).aspx
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Imprimir archivo PDF

Post by Bayron »

Mil Gracias Daniel,
El codigo que colocaste, hace exactamente lo que necesitaba...
Lamentablemente no funcionó como quería, ya que sí imprime, pero el Acrobat se queda abierto....
Voy a seguir intentando a ver que consigo, espero no estar tratando de reinventar la rueda, ya que no se hasta donde llega el manejo de archivos PDF de FiveWin...y si este puede imprimirlos!!!!
por ahora, lo que probé fue:

Code: Select all | Expand

WaitRun(  'acrord32 /n /t l:\mayapos\colegios\fillpdf\salida.pdf "Brother MFC-6490CW Printer" "USB001" "Brother MFC-6490CW Printer,3, WindowsNT x86" ', 0 )
 

Hasta ahora gana SumatraPDF....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
Post Reply