imprimir um documento em pdf ja pronto

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Abel
Usuário Nível 3
Usuário Nível 3
Mensagens: 332
Registrado em: 14 Mar 2012 13:16
Localização: sao paulo / sp

imprimir um documento em pdf ja pronto

Mensagem 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
Avatar do usuário
bencz
Usuário Nível 4
Usuário Nível 4
Mensagens: 524
Registrado em: 28 Abr 2012 17:36
Contato:

imprimir um documento em pdf ja pronto

Mensagem 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
Imagem
Avatar do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

imprimir um documento em pdf ja pronto

Mensagem 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
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
zazibr
Usuário Nível 2
Usuário Nível 2
Mensagens: 72
Registrado em: 11 Set 2004 17:07
Localização: Campo Grande/MS

imprimir um documento em pdf ja pronto

Mensagem 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
Abel
Usuário Nível 3
Usuário Nível 3
Mensagens: 332
Registrado em: 14 Mar 2012 13:16
Localização: sao paulo / sp

imprimir um documento em pdf ja pronto

Mensagem por Abel »

Valeu pessoal pela dica do sumatrapdf

Agradeco mesmo :))
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

imprimir um documento em pdf ja pronto

Mensagem por JoséQuintas »

Se não me engano, só abrir passando o parâmetro /p
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Responder