Página 1 de 1

imprimir um documento em pdf ja pronto

Enviado: 11 Jul 2014 20:37
por Abel
ola pessoal,
tenho um documento salvo em pdf ja pronto e preciso imprimir algumas copias utilizando meu sistema em harbour.
procurei no forum mas vi a opcao de gerar e imprimir, e neste caso ja tenho ele pronto, é so imprimir direto pelo sistema.

tentei Myrun("arquivo.pdf") mas neste caso ele abre o arquivo e o usuario teria que utilizar a opcao de imprimir, e gostaria de imprimir direto.

alguem sabe se existe alguma forma de fazer isso ?

Utilizo harbour, modo console
Desde ja agradeço,
Abel

imprimir um documento em pdf ja pronto

Enviado: 12 Jul 2014 12:16
por bencz
Para fazer isso, utilizo um outro programa, o SumatraPDF
Basta colocar o EXE dele juntamente ao seu executavel e utilizar a linha de comando correta!
Utilizo ele em varios programas que eu desenvolvi em Harbour, p/ imprimir o PDF....

https://code.google.com/p/sumatrapdf/wi ... eArguments

imprimir um documento em pdf ja pronto

Enviado: 12 Jul 2014 12:30
por asimoes
Exemplo usando sumatra.
Você baixa o sumatra neste endereço:

http://blog.kowalczyk.info/software/sum ... er-pt.html

Código: Selecionar todos

FUNCTION MAIN
PRIVATE cPrinter:=WIN_PrinterGetDefault()
   IMP_PDF("SEUPDF.PDF",.T.)
RETURN Nil

FUNCTION Imp_PDF( cSource,lEspera )
LOCAL oShell, lOk:=.T., nStyle
   HB_Default(@lEspera,.T.)
   TRY
      oShell:=win_OleCreateObject( "WScript.Shell" )
   CATCH
      TRY
         oShell:=win_OleCreateObject( "WScript.Shell" )
      CATCH
         lOk:=.F.
      END
   END
   IF lOk
      TRY
         /*
         intWindowStyle
         Description
         0  Hides the window and activates another window.
         1  Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
         2  Activates the window and displays it as a minimized window.
         3  Activates the window and displays it as a maximized window.
         4  Displays a window in its most recent size and position. The active window remains active.
         5  Activates the window and displays it in its current size and position.
         6  Minimizes the specified window and activates the next top-level window in the Z order.
         7  Displays the window as a minimized window. The active window remains active.
         8  Displays the window in its current state. The active window remains active.
         9  Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
         10 Sets the show-state based on the state of the program that started the application. 
         */
         nStyle:=0

         oShell:Run("sumatrapdf.exe -print-to "+'"'+cPrinter+'"'+" -reuse-instance -lang pt "+'"'+cSource+'"', nStyle, lEspera) 

      CATCH
         lOk:=.F.
      END
      oShell:=Nil
   ENDIF
RETURN lOk

imprimir um documento em pdf ja pronto

Enviado: 12 Jul 2014 12:49
por zazibr
o sumatraPDF é a opção


ou se tiver dinheiro pode usar o sdk da propria adobe

http://www.adobe.com/devnet/pdf/library.html

imprimir um documento em pdf ja pronto

Enviado: 12 Jul 2014 14:13
por Abel
Valeu pessoal pela dica do sumatrapdf

Agradeco mesmo :))

imprimir um documento em pdf ja pronto

Enviado: 12 Jul 2014 21:31
por JoséQuintas
Se não me engano, só abrir passando o parâmetro /p