We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

File Format issue from PDF to word

Hi,

I am checking for my File Format using the Fileformatinfo class of Aspose Words.I want to process a file only if the File format is of word.So when I Pass a .pdf File I get the file format as ‘Text’, which I think ideally I should get unknown.
Any Solution for this one ?

Public Function CanHandleFileType(ByVal sFileName As String) As Boolean
Dim format As LoadFormat
Dim fs As FileStream = Nothing
Try
fs = IO.File.Open(sFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim info As FileFormatInfo = FileFormatUtil.DetectFileFormat(fs)
format = info.LoadFormat
Catch ex As Exception
format = LoadFormat.Unknown
Finally
If Not fs Is Nothing Then
Try
fs.Close()
Catch
End Try
End If
End Try

Select Case format
Case LoadFormat.Html, LoadFormat.Unknown
Return False
Case Else
Return True
End Select
End Function
Hi,

Thanks for your inquiry. Could you please attach your PDF document here for testing? I will investigate the issue on my side and provide you more information.

Best regards,