Opening a TIFF file on a specific page from the command line

2

1

I'm trying to open a TIFF file which directs toward a certain page upon opening instead of page 1.

Running this command opens the TIFF file on page 1:

cmd /c D:\mytiff.tiff

Meanwhile, I can open a PDF file with Adobe Acrobat Reader to a specific page with this command:

cmd /c start AcroRd32.exe /A "page=3" "D:\myPdf.pdf"

Is it possible to do this for a TIFF file from the command line?

Karen

Posted 2018-03-19T03:55:08.720

Reputation: 23

If your question is about which command you need to run you only need the command you have tried, you don’t need any java code, because we won’t provide java code to you just the command. You were given bad advice at SO when you were told to submit this question as-is here at Superuser – Ramhound – 2018-04-05T08:07:54.993

@Ramhound actually yeah i wasnt expecting any java code here. Only the cmd line. Should i delete my question and reask about it? – Karen – 2018-04-05T08:09:02.430

Answers

2

First of all this command:

cmd /c D:\mytiff.tiff

does nothing more then invoking the open command that is associated with the .tiff extension. Users can assign any application to an extension with the assoc command. You might get surprising results if users tinkered with that. Looking up what drives the viewing of .tiff I find in the registry for HKCR\TIFImage.Document\shell\open\command

%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Gallery\PhotoViewer.dll", ImageView_Fullscreen %1

The %1 in there depicts the filename. PhotoViewer.dll doesn't take any other arguments so you can't control which page should be shown.

To answer your question: You can't control which page to show with the tools available on a plain Windows box.

My advice would be to use the commandline found in the registry key to start the PhotoViewer with the file you want to show.
Once the PhotoViewer is running use Sendkeys commands (examples depending on your choice of programming language can be found here or here or here) to move to the specific page. Not awesome, but might work for your purpose.

One alternative is to find an Tiff Viewer that does support commandline arguments to show a specific page. You need to bundle your app then with this external viewer. Another alternative is to use a tool like Imagemagick and convert the Tiff to a PDF first. From there you already know how to show a specific page.

rene

Posted 2018-03-19T03:55:08.720

Reputation: 1 115

Your SendKeys solution works like charm, although it would take a few second to go to desired page. (The document usually is 100-180ish page). But its a trivial matter. And lastly they dont want external software which is quite a burden for the find an tiff viewer suggestion. Thanks for the great answer! – Karen – 2018-04-05T09:11:08.050