Opening PDF from a DataGrid - vb.net

I have a DataGrid that reads from a table in a DB the name and file name (full address) of certain files. What I want is when the user double clicks the file it opens the PDF reader and loads the file. How would I go about doing this?
EDIT: This is my current code:
Dim row2 As String = DataGridView1.Rows(e.RowIndex).Cells(3).Value
Process.Start("Acrobat.exe", row2)
VS throws the exception that file cannot be found. I checked the variable and its giving me the correct data. I also tried putting row2 between the quotation marks and no go either. It just doesn't find the file.
WORKING UPDATE: Alright it was a very simple mistake
Process.Start("AcroRd32.exe", row2)
Row2 grabs the data from a cell I have in the datagrid that has the file location.

Process.Start("filename") will open a file using the default application on that machine.
In most cases, the above approach is correct. It is not dependent on a particular application or particular version of the application being pre-installed on the target machine. The advantage is loose coupling between your application and the PDF viewer.
If you really need to, you can use Process.Start() to launch a particular program, many of which will accept a filename as a command line parameter, like so:
Process.Start("IExplore.exe", "C:\myPath\myFile.htm")
(This example taken from the linked MSDN documentation)
You can find a list of Adobe Reader's command line arguments here:
Adobe Reader Command Line Reference
Update: The above link is old (focuses on version 7). You can find version 8 documentation here:
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
I cannot find a reference for version 9.

Related

Add link to PDF within a PDF file using relative addressing

I want to add a link to some text within a PDF that will bring up another PDF that is located in the same folder. I wish to use relative addressing so that the PDF suite is transportable to other users and computers. I wish this to work on Linux and Macs.
LibreOffice Draw, despite promises, writes out the link address as a full path. Thus if taken to another computer with another user the link fails to work.
I tried manually editing the PDF files using vi and altered the link syntax so;
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[940.9 480.3 1200.7 507.9]/A<</Type/Action/S/URI/URI(Content/Information.pdf)>>
where the target file, "Information.pdf" is in a subdirectory "Contents".
On Linux using Document Viewer, it works! On an Apple, Preview (a PDF viewer) interprets the target file needs to be opened by some application. Adobe Reader doesn't like this syntax either. I tried prefixing the filename with the keyword "file:" which works for a full path but not with relative addressing.
Does anyone know what syntax might work for me
Editing a PDF you can select text and add a hyperlink using LibreOffice Draw. It is then possible to edit the PDF file with a text editor such as vi.
To find the line with the link search for the filename of the target. One problem is that LibreOffice insists in using a fully qualified domain name to locate the file and this won't work after the file is moved, say to another computer. The unedited line should be similar to;
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[940.9 480.3 1200.7 507.9]/A<</Type/Action/S/URI/URI(File:<fullpathname>/Content/Information.pdf)>>
Where Content/Information.pdf is the link target in the same directory as the linking pdf. This line should be changed to
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[940.9 480.3 1200.7 507.9]/A<</Type/Action/S /Launch/F(Content/Information.pdf)>>
This works on Unix and MacOs

Excel on Mac. Cannot open IQY file in Data/Get External Data/Run Web Query

I am running Excel version 16.45 on Mac.
I have created a .iqy and saved it in the Queries directory alongside certain templates which were already there.
I go to Data/Get External Data/Run Web Queries. While the templates are accessible, my file is visible but greyed out (same thing happens if I save the file in a different directory).
Would anyone be able to help?
According to your information, I would like to confirm whether the issue occurs when you follow the steps as below:
1.Create a Word file, paste the web URL.
2.Save the Word as .iqy with .txt format.
3.Choose MS-DOS as coding.
4.Create an Excel file and click "Data >Get External Data >Run Web Query (Or Run Saved Query) " of the Bar
I was able to address the issue as follows.
When navigating to the relevant directory with Finder, the '.iqy' file appears to be appropriately named (as per Image 1).
In fact, if you reach the file in Terminal, the file is saved as '.iqy.txt'.
So all I had to do is rename the file, simply removing the '.txt' string at the end.
Screen you see when navigating in Finder

Trouble specifying path to open Excel woorbook in vb.net app

I have a WFP app that works well. I open an Access DB and want to do the same with an Excel workbook. Opening the DB is not an issue as I am able to remove the drive letter from the path. I am having a bit of an issue with the search path for the workbook. My path operates as expected when the drive letter is specified [here is the line of code that works properly -- xlWorkBook_AR = xlApp_AR.Workbooks.Open("S:\11_2017_Spring\MPRecords-2\Accounting\FinancialSystem.xlsm")]). When I remove the drive specification from the path it does not operate as expected. I receive an error stating the file is not found. What do I need to do to make this dynamic?
Thanks in advance.
Ed
Try this (if it works for your scenario):
Place the excel file in the same folder as your app (.exe) (I assume this works for your needs).
Use this code to dynamically get the path of your app, and then add on the name of the file, something like the below:
Application.StartupPath & "\FinancialSystem.xlsm"
Supply this to excel's .Open method and I believe it will work.
You will need to import System.Windows.Forms. Read about Application.StartupPath property here: https://msdn.microsoft.com/en-us/library/system.windows.forms.application.startuppath.aspx

Convert Omniform to PDF in bulk/commandline

We have a large number of Omniform files (around 100,000). We're updating our main server OS from Windows Server 2003 to Windows Server 2008. Omniform isn't supported in Windows Server 2008 so we need to convert these files to pdf (or another viewable format).
What I've tried so far:
Using Print or PrintTo verb from inside a program using Process.StartInfo and using a PDF Writer printer.
Using Print directly from a command line using the Print verb with the PDF Writer set as the Default Printer:
C:\PROGRA~1\ScanSoft\OMNIFO~1.1\OmniForm.exe /p "Test.ofm"
Both of these Print successfully and a PDF appears. However it prints only the Form, not the Form with the entered in Data. Namely you'll get Last Name then a blank instead of showing the entered last name.
If I print to a normal printer and not a PDF Writer I get the same behavior. Form only with no entered in data appearing.
I've tried calling Nuance Tech Support and they suggested doing them manually 1 at a time. Given this would take someone about half a year of full time work to do, that's not a viable option for us.
So what I'm looking for is a solution to the command line print above
If an "image" of the filled-in form might work for you, Omniformat might help you out. It basically converts the file to pdf using a print-to-file method, but it might help you out, since it does batch conversion.

Why does my PDF ask for a password after being retrieved from Visual SourceSafe?

PREFACE: Yes we're moving away from VSS in the next few months.
One of my web projects contains, as one of its files, a PDF. The PDF on our QA site is being pulled from VSS.
A QA tester recently told me he's being prompted for a password when he tries to open it. VSS says the file I have on disk is different than the one it has, so I updated it, but afterwards it's still being shown as different.
So basically VSS is mangling my PDF and the results are so wobbly that Adobe Acrobat Reader is confused and thinks it has a password.
I've tried adding it as Auto-Detect and as Binary. Same results.
Why does my PDF ask for a password after being retrieved from Visual SourceSafe and how can I prevent it?
Do you have the SourceSafe 2005 Update installed?
Handy list of known issues: http://blogs.msdn.com/richardb/archive/2007/06/06/list-of-bugs-fixed-in-sourcesafe-2005-gdr.aspx
The PDF bug was one of the most commonly requested hotfixes: http://support.microsoft.com/kb/925234
I've tried adding it as Auto-Detect and as Binary. Same results.
To be clear, are you adding a version of the file you know is not already corrupted? Even so, there are plenty of other bug fixes on the list above which can cause random file corruption -- try that first.
You can remove PDF password by this tool:
Advanced PDF Password Remover 5.0
Step 1: Import PDF files
Click the "Add File(s)" button, browse your computer to find the PDF files and load them.You can import as many as 200 PDF files into this program for every batch processing.The imported files are listed in the file list window as below.
Step 2: Set output folder
You can customize a folder to save the output files all together. The default folder is My Documents\Advanced PDF Password Removerr. Click "Brows" button to specify a folder on your computer, or you can make a new folder manually in the text box.
Step 3: Remove restrictions
Click "Start" button, and the files are processed one by one.
"SUCCEED" is displayed in the Result column after the removing process is finished.