Prizm Content Connect
Configuring Flash Viewer Samples

Prizm Content Connect supports real-time processing of documents and can be integrated with your existing applications.

After you have installed Prizm Content Connect, insert the following files into your code for complete integration:

You can call convert2swf utility from within your application code by applying:

Copy Code

<%@ Page Language="VB" Debug="true" %>

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Web.Configuration" %>

' For this sample, the location of files and the imaging service are
' configured in prizmconfig.xml file.

' Environmental Setup

'original document location
' if this location is on network, make sure that AJAXDocumentService is running under a network account
' if this location is on network, do not pass mapped drive path, instead pass absolute path like \\computername\file.pdf
Dim documentLocation As String
documentLocation = PccConfig.DocumentFolder

Dim tempLocation As String = PccConfig.TempFolder

'**Document to be viewed. Just pass the document name**
'**Document to be viewed can be passed as querystring. **
Dim document As String
Dim origDocument As String = Request.QueryString("document")
document = origDocument

If document Is Nothing Then
Response.Write("You must include the name of a document in the URL.<br/>")
Response.Write("For example, click on this link: <a href=""Default.aspx?document=sample.doc"">Default.aspx?document=sample.doc</a>")
End If

' get document extension. Will be used if document being passed is a url
Dim extension As String = document.Substring(document.LastIndexOf("."))

' Download file, if url is passed
If document.Contains("http://") OrElse document.Contains("https://") Then
Dim url As String = document
document = PccCommon.getDownloadedName(document)
Dim client As New WebClient()
client.DownloadFile(New Uri(url), System.IO.Path.Combine(tempLocation, document))
documentLocation = tempLocation
End If
Dim originalDocument As String = System.IO.Path.Combine(documentLocation, document)

If System.IO.File.Exists(originalDocument) Then
Dim f As New FileInfo(documentLocation + document)

Dim UniqueFileIdHash As String = PccCommon.getFileHash(documentLocation + document)
'generate swf file has name
Dim SWFFile As String = UniqueFileIdHash & "_" & document & ".swf"
Dim SWFFilePage1 As String = document & "_" & UniqueFileIdHash & "_1.swf"
Dim targetSwfLocation As String = System.IO.Path.Combine(tempLocation, SWFFile)
Dim targetSwfLocationPage1 As String = System.IO.Path.Combine(tempLocation, SWFFilePage1)

If Not System.IO.File.Exists(targetSwfLocationPage1) Then
' make sure target directory exists
Dim targetSwfDir As [String] = System.IO.Path.GetDirectoryName(targetSwfLocation)
If Not System.IO.Directory.Exists(targetSwfDir) Then
End If

' create target SWFs
Dim HttpWReq As HttpWebRequest = DirectCast(WebRequest.Create(PccConfig.ImagingService + "/convert2swf?enterprise=3&source=" & HttpUtility.UrlEncode(originalDocument) & "&target=" & targetSwfLocation), HttpWebRequest)
HttpWReq.Timeout = 660000
Dim HttpWResp As HttpWebResponse = DirectCast(HttpWReq.GetResponse(), HttpWebResponse)
Dim sr As New StreamReader(HttpWResp.GetResponseStream(), System.Text.Encoding.UTF8)
Catch generatedExceptionName As Exception
Response.Write("Error connecting to the imaging service " & PccConfig.ImagingService & ".<br/>")
Response.Write("For more information, go to the <a href=""Diagnostics.aspx"">Diagnostics</a> page.")
End Try
End If


See Also



©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback