We are trying to create a web service that will create a pdf using a third party tool. Only trouble is none of us have ever created a WCF and then consumed it on a Windows Form before.
I have added the reference successfully and can reference the class I created but I cannot figure out how to make it do it's job. I need to send a URL to the web service from a Web Browser Control. The web service will then create the PDF in byte code, then send it back to the client, the client will then show the PDF in a Web Browser Control. Can someone please tell me what I need to do? Any help will be appreciated. Thanks.
VB:
Imports System.ServiceModel
Imports WebSupergoo.ABCpdf8
<ServiceContract()>
Public Interface ICreatePDF
<OperationContract()>
Function CreatePDF(ByVal givenURL As String) As Byte
End Interface
The Client Windows Form has the Service referenced. I just need to send the URL and then return the byte data the service renders.
svc.vb:
Imports WebSupergoo.ABCpdf8
Public Class CreatePDF
Implements ICreatePDF
Public Function CreatePDF(ByVal givenURL As String) As Byte Implements ICreatePDF.CreatePDF
Dim theDoc As New Doc
Dim theID = theDoc.AddImageUrl(givenURL, True, 0, True)
Do While True
theDoc.FrameRect()
If Not theDoc.Chainable(theID) Then
Exit Do
End If
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageToChain(theID)
Loop
theDoc.SaveOptions.Linearize = True
Dim theData As Byte() = theDoc.GetData()
Return theData(0)
End Function
End Class