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
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
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
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 Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!