ethanmgomes
4 months agoNew Contributor II
PDF file "damaged" on Extract
Hello,
I have created an extensibility rule to extract values from the FileBytes column in the XFW_UTM_SupportDoc table, then convert the FileBytes to a file and save in the file share. See below for code snippet:
'Execute query and save attachment to file share folder
Using dt As DataTable = BRAPi.Database.ExecuteSql(dbConnApp, fileBytesQuery, True)
If Not dt Is Nothing Then
For Each dr As DataRow In dt.Rows
'Process rows
Dim fileBytesValue As Byte() = dr("FileBytes")
Dim fileNameValue = dr("FileName")
Dim taskNameValue = dr("TaskName")
Dim fullFileName As String = fileNameValue
'Create file in file share, and store folder name
Dim fileInfo As XFFileInfo = New XFFileInfo(FileSystemLocation.FileShare, fullFileName.toString)
fileInfo.FolderFullName = "Applications/" & applicationName & "/Batch/Harvest/TaskManager_Exports"
'Convert fileBytes to file, and save in folder path
Dim fileFile As XFFile = New XFFile(fileInfo, "", fileBytesValue)
BRApi.FileSystem.InsertOrUpdateFile(si, fileFile)
Next
End If
End Using
This code runs successfully for .xlsx, .csv, and .docx files. It also executes without error for .pdf files, but I am met with this error after I download the .pdf file and open:
Any thoughts on why this is happing specifically for .pdf files?