Convert Octet-stream To Pdf

PDF Converter View other document file formats Technical Details Each PDF file encapsulates a complete description of a 2D document (and, with the advent of Acrobat 3D, embedded 3D documents) that includes the text, fonts, images and 2D vector graphics that compose the document. Find centralized, trusted content and collaborate around the technologies you use most. The service in Gateway is returning a pdf file(see below the response.content) and I need to convert it to base64 before send the response to Portal in json format. I am using a python script to convert the response.content to base64, which I found being used in some other SAP policies, but the conversion is not working fine.

Hi,
I have a byteArray which is a docx. I'm trying to convert it to pdf and add it to the Response object so the user can download it or open it.
I've tried this which the pdf is corrupted
'docArray is the byte file from the db
Try
Dim doc As Spire.Doc.Document = New Spire.Doc.Document()
Dim oFileStream As System.IO.FileStream
oFileStream = New System.IO.FileStream(strTempName, System.IO.FileMode.Create)
'Write file to stream
oFileStream.Write(docArray, 0, docArray.Length - 1)
'Add docx to stream
doc.LoadFromStream(oFileStream, Spire.Doc.FileFormat.Docx)
'Covert docx to PDF
doc.SaveToStream(oFileStream, Spire.Doc.FileFormat.PDF)
Dim streamLength As Integer = Convert.ToInt32(oFileStream.Length)
Dim fileData As Byte() = New Byte(streamLength) {}
' Read the file into a byte array
oFileStream.Read(fileData, 0, streamLength)
oFileStream.Close()
strTempName = strTempName.Substring(0, strTempName.IndexOf('.'))
Context.Response.Clear()
Context.Response.AddHeader('Content-Disposition', 'inline;attachment; filename='' & strTempName & '.pdf' & '')
Context.Response.AddHeader('Content-Length', fileData.Length.ToString())

Convert Octet-stream To Pdf Download


Context.Response.ContentType = 'application/octet-stream'
Context.Response.BinaryWrite(fileData)
Context.Response.Flush()
Catch ex As Exception
Context.Response.ContentType = 'text/plain'
Context.Response.Write(ex.Message)
Finally
Convert octet-stream to pdf download Context.Response.[End]()
End Try
And this gives me errors...
Using ms As Stream = New MemoryStream(docArray, True)

Convert Octet-stream To Pdf


ms.Write(docArray, 0, docArray.Length)
doc.SaveToStream(ms, Spire.Doc.FileFormat.PDF)
Please help.

Convert Application/octet-stream To Pdf C#


Thanks,

Application Octet Stream Converter


J Torres