Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good morning.
I have a situation that is not how to solve.
Currently I have a webservice that generates a PDF file, converts it to an array of BYTE () and returns as a result.
In ASP.NET. I had no trouble converting the byte array () in the PDF and display it in the Navigator. and then send the PDF to be printed by the user.

now I'm developing an application (WindowsForms) must display the PDF file in a PictureBox or a screen printing

I have referenced the web service in my application and this is what I do:

VB
Dim WsAuto As New WsPDF.AutosSoapClient 'this reference has a PDF Method: WsAuto.PDF()
Dim Ws As New WsPDF.DataAuto ' this one, is to Fill the data in the PDF File
Ws.Nombre1 = "NAME OF DRIVER" 'Poliza.NombreConductor
Ws.Licencia1 = "DRIVER NUMBER" 'Poliza.NoLicencia
Ws.FechaNacimiento1 = "1983-09-27" ' Poliza.FechaNacimiento
Ws.Ocupacion1 = "Systems" 'Poliza.Ocupacion
pboxImagen.Image = Image.FromStream(New MemoryStream(WsAuto.PDF(Ws, WsPDF.TipoPoliza.Resto)))
'WsPDF.TipoPoliza.Resto, is only for select the template the options are: 1,2 and 99


that's my problem
I do not know how to pass an array of bytes () to a picturebox or Print Document.
regards.
Posted
Comments
Sergey Alexandrovich Kryukov 10-Apr-12 15:08pm    
Do you have any particular reason to work with PDF. You can, but why?
--SA
Rene Bustos 10-Apr-12 16:51pm    
hi , just for Security reason in the company. Regards!
Sergey Alexandrovich Kryukov 12-Apr-12 12:44pm    
Security? With PDF?! Somebody is silly here, maybe me, as I fail to see the idea... :-)
--SA
Rene Bustos 24-Apr-12 17:31pm    
seems that if there is here :). do not worry, let me and I will explain to you. the PDF has javascript functions and areas protected by javascript. is a form that the company developed for protection is an algorithm, I would love to post about the security method develop .. but we will not allow it.
greetings and thanks anyway.

1 solution

I don't think you can just directly put an array of bytes that contains an PDF into an picture box. You'd have to first convert the PDF into an image. Why don't you instead save the PDF to a temporary location and then just open it with adobe? (Yes, this requires users to have adobe reader...but that's not too drastic a requirement anymore. Most people already have it on their computers.)
 
Share this answer
 
Comments
Rene Bustos 24-Apr-12 17:33pm    
Thanks a lot Kschuler that way was easy, regards.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900