Hi,
In ASPOSE.Cells, there is an option to read the AbsolutePath of the uploaded document, as shown below,
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(stream);
string test = wb.AbsolutePath;
Is there a similar way to get the AbsolutePath for Word and PDF documents in ASPOSE?
Thanks in advance for your help!
Shiva
@naru.shiva I am afraid there is no such property in Aspose.Words. However, there is Document.OriginalFileName property, which allows to get the original file name of the document.
@naru.shiva
Aspose.PDF also provides complete path of the loaded document using Document.FileName
Property.
Document document = new Document(dataDir + "input.pdf");
var fPath = document.FileName;
@alexey.noskov ASPOSE.WORDS OriginalFileName property is returning empty.
Aspose.Words.Document wordDoc = new Document(stream); //uploaded word document stream
string testFileName = wordDoc.OriginalFileName; //This is empty
@asad.ali ASPOSE.PDF FileName property is returning empty.
Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(stream); //PDF doc stream
string fPath = pdfDoc.FileName; //Empty
@naru.shiva
Because you are initializing the document using Stream and we need to investigate whether information about absolute path can be extracted from a PDF stream or not. Therefore, an investigation ticket as PDFNET-57279 has been logged in our issue tracking system and we will let you know once it is resolved. Please spare us some time.
About Aspose.Words, you will be provided with respective feedback shortly.
@naru.shiva
This is an expected behavior. Document.OriginalFileName properly is initialized only if document is loaded from file. When the document is loaded from stream there is no actual file and as a result no file name. This is mentioned in the property remarks:
Remarks
Returns null
if the document was loaded from a stream or created blank.