How to get file name of after DisplayFromFile("")

Discussions about document viewing.
Post Reply
RNeall
Posts: 12
Joined: Sun Jun 06, 2010 10:17 pm

How to get file name of after DisplayFromFile("")

Post by RNeall » Sun Aug 01, 2010 6:21 pm

If I use GdViewer.DisplayFromFile(""), how can my program learn the filename the user selected? There appears to be no property within GdViewer for file name.

Thanks,

Randy

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How to get file name of after DisplayFromFile("")

Post by Loïc » Tue Sep 07, 2010 9:11 pm

Hi Randy,

Sorry for the delay. Currently there is no way to get file path used to open a document. I've added the feature on our whish-list.

Kind regards,

Loïc

RNeall
Posts: 12
Joined: Sun Jun 06, 2010 10:17 pm

Re: How to get file name of after DisplayFromFile("")

Post by RNeall » Tue Sep 07, 2010 10:10 pm

Don't worry. I used the generic file dialog instead.

Frank
Posts: 1
Joined: Wed Jan 25, 2012 12:11 pm

Re: How to get file name of after DisplayFromFile("")

Post by Frank » Wed Jan 25, 2012 12:15 pm

Hi Loïc,

is it foreseeable when this feature will be available ?
So it would be very nice to get the filename after i use the DisplayFromFile-Method.

Kind Regards

Frank Scheer

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: How to get file name of after DisplayFromFile("")

Post by SamiKharma » Thu Jan 26, 2012 12:58 pm

Hi,

Unfortunately we have not implemented it yet, but here is what you can do:

Go to our demo c#/ImageProcessing, and in the Open Routine there is such an implementation, to make things easier:

Code: Select all

string file;
String Name;
int m_CurrentImage;
GdPictureImaging Imaging = new GdPictureImaging();
                DialogResult result = MainFormReference.openFileDialog1.ShowDialog(); // Show the dialog.
                if (result == DialogResult.OK) // Test result.
                {
                    file = MainFormReference.openFileDialog1.FileName;
                    try
                    {
                        m_CurrentImage = Imaging.CreateGdPictureImageFromFile(file);
                        if (m_CurrentImage == 0)
                        {
                        Name = Path.GetFileName(file);
                        }
                   }
                   catch (IOException)
                    {
                    }
               }
                


Hope this helps.
Best Regards,
Sami Kharma
GdPicture Support Team Member

absoffthewake
Posts: 32
Joined: Wed Jul 18, 2007 11:58 pm

Re: How to get file name of after DisplayFromFile("")

Post by absoffthewake » Thu May 16, 2013 5:39 pm

I figured out a better way to return the file path of the current image.

When displaying an image, save the file path to the .tag property of the image viewer:
GDImgCtrl.Tag = FileLocation

When you want to figure out what the current file path is use the code:
If GDImgCtrl.PageCount > 0 then currentfilename = GDImgCtrl.Tag

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How to get file name of after DisplayFromFile("")

Post by Loïc » Thu May 16, 2013 5:50 pm

There is now an internal function for such purpose.
From the reference guide:
You can subsequently use the GetLastPath() function to retrieve the path of the selected file.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest