2

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?

2
  • 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 Apr 5 '18 at 8:07
  • @Ramhound actually yeah i wasnt expecting any java code here. Only the cmd line. Should i delete my question and reask about it? – Karen Apr 5 '18 at 8:09
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.

1
  • 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 Apr 5 '18 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.