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

조회 수: 3 (최근 30일)
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
Walter Roberson
Walter Roberson 2021년 8월 27일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Yongjian Feng
Yongjian Feng 2021년 8월 26일
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
Sandra Dening
Sandra Dening 2021년 8월 27일
편집: Sandra Dening 2021년 8월 30일
Perfect, thank you!
Is there also a command to open a new tab in Acrobat instead of a new sheet?
Yongjian Feng
Yongjian Feng 2021년 8월 27일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by