Jump to content
Sign in to follow this  
obamaself

Impressao em PDF com printdocument

Recommended Posts

obamaself

Boas!

Eu queria imprimir um formulário através de printdocument.

eu consigo imprimir só que o documento sai no office one note.

eu queria qe saisse em pdf.

alguem me pode ajudar??

:wallbash:

Share this post


Link to post
Share on other sites
tiago40812

Boas, isso é algo complicado...

Já tentei fazer o mesmo e optei por usar documentos em .xps com o XpsDocumentWriter e a library System.printing.

Para imprimires o pdf, tens que abrir um processo do AcrobatReader.

Lê isto que te vai ajudar: http://stackoverflow.com/questions/273675/print-existing-pdf-or-other-files-in-c

Ou usa isto:

Dim pathToExecutable As String = "AcroRd32.exe"

Dim sReport = "C:\..." 'PDF file

Dim SPrinter = "Impressora1" 'Printer Name

Dim starter As New ProcessStartInfo(pathToExecutable, "/t """ + sReport + """ """ + SPrinter + """")

Dim Process As New Process()

Process.StartInfo = starter

Process.Start()

Process.WaitForExit(5000)

Process.Kill()

Process.CloseMainWindow()

Process.Close()

O problema deste código e que te vai estar sempre a abrir processos e vais ter problemas quando os processos pendurarem e não saberes de onde vêm...

Cumprimentos


Tiago Vicente

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.