Jump to specific page in matlab multiply times // closing PDF File in Matlab

4 visualizzazioni (ultimi 30 giorni)
By clicking on a button in a Matlab GUI, the program should jump to a specific page in the PDF using the system command like in this example: system ("Acrobat directory" /A "page=2" "your file directory" &);
But while another Tab is open and the button is clicked on again, it should jump to another page in the same PDF, using the same command, while the pdf file is still open:
System ("Acrobat directory" /A "page=18" "your file directory" &);
But unfortunately Matlab reopens Acrobat Reader at the previous page 2, not at page 18.
When I close Acrobat Reader before calling the system command again, it works. (Closing with: (dos('taskkill /F /IM acroRd32.exe');)
This is an example of how I solved it till now.
function callButton(obj)
switch obj.name
case 'Anna'
cell = 2;
case 'Charlotte'
cell = 18;
end
dos('taskkill /F /IM acroRd32.exe');
system(['"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" /A "' ['page=' num2str(cell)] '" "' [path] '" & ']);
end
Obviously, I don’t want, that Acrobat Reader is always shut down, cause there might be unsaved changes or other needed files still open.
So, is there a way, to close only the specific file in Acrobat Reader, or to even jump to another page without having to close Acrobat before?
I really hope someone can help me :)
  1 Commento
Walter Roberson
Walter Roberson il 27 Ago 2021
Maybe you would be able to get somewhere by using .NET System.Diagnostics.Process to open Acrord32 as a process, as you would then be able to send commands to it. But being able to send commands doesn't necessarily mean that it will respond the commands.
The solution might possibly be to use an ActiveX control to talk to Acrord32

Accedi per commentare.

Risposta accettata

Yongjian Feng
Yongjian Feng il 26 Ago 2021
This is not a matlab issue.
If you run those two commands on a terminal, you will see the same behavior. Basically the first command opens Acrobat Reader and jumps to the page. The second command just calls up Acrobat Reader to the front, because it is already opened.
  4 Commenti
Sandra Dening
Sandra Dening il 27 Ago 2021
Modificato: Sandra Dening il 30 Ago 2021
Perfect, thank you!
Is there also a command to open a new tab in Acrobat instead of a new sheet?
Yongjian Feng
Yongjian Feng il 27 Ago 2021
Might not be possible. It seems like those PDF Open Parameters only allow you to control acrobat/reader when a new instance is started. You might not be able to control an already started instance.

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by