PdfFileInfo.InputFile obsoletion warning

Hi,

I just upgraded my Aspose PDF instance from 6.6.0 and now have an warning that my PdfFileInfo objects are using a deprecated property InputFile, and that I should use BindPdf(inputFile) for facade initialization. I am not using this property for initialization - instead I’m just using it to read the name of the file that is opened.

Is there a new way to get the name of the document that is currently referenced by the PdfFileInfo instance?

Hi Aru,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for using our product.

Well, PdfFileInfo.InputFile was used to specify the input file name for initialization purposes and now the same can be achieved using PdfFileInfo.BindPdf method. Now, regarding your requirement, I think you can use Document.FileName property to get the name of the file. Please see the following sample code in this regard.

Document document = new Document("input.pdf");

//Get the File Name

Console.WriteLine(document.FileName);

PdfFileInfo info = new PdfFileInfo();

info.BindPdf(document);

In case of any further query, please do let us know.

Thank You & Best Regards,

Thanks for your reply, Nasherwan.

While that method would work (as would tracking the path in a string independent of the PdfFileInfo object), I’m currently defining the path via the constructor, i.e.:

new PdfFileInfo(@“c:\path\to\file.pdf”);

Is there a way for me to see the underlying Document object that is created within that constructor, or is it absolutely necessary for me to create one outside of PdfFileInfo?

Thanks!

Hi Aru,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, PdfFileInfo does not provide the feature to get the underline document object. PdfFileInfo class allows you to manipulate file specific information / properties of a PDF file like Author, Title, Keyword, and Creator etc. To work with the document object, as suggested in my previous reply, you can instantiate the document object with your template PDF file and use it.

Please feel free to contact support in case you need any further assistance.

Thank You & Best Regards,