MATLAB Answers

How can I open and later close PDFs from appdesigner (for viewing PDFs only, not data extraction)?

18 views (last 30 days)
Kerry Elizabeth Costello
Kerry Elizabeth Costello on 15 Apr 2020
Hello,
I am creating an app in appdesigner (R2019b) to quality check some data. The data is exported from another program as PDF files that contains a few pages of images of raw data (gait biomechanics and electromyography waveforms for each participant in our study). I would like for the app to open a PDF, allow the user to look through the PDF, interact with my app to tell the app which data is good or bad based on visual inspection of the PDF, then close the PDF and go to the next participant's PDF when the user clicks a "next" button in the app.
I was hoping to use:
fileName = 'P511_baseline.pdf';
[fid,msg] = fopen(fileName);
so that I could later close it with
fclose(fid)
but this doesn't seem to actually open the PDF for viewing, only for writing.
I was able to get the PDF to open for viewing using:
unix(['open "' fileName '" &']);
However, I haven't been able to figure out how to close it when opening it in this way. For some quality checking protocols, the user will need to check a few hundred PDFs so it would be best to be able to close them automatically from within the code, rather than the user closing them manually. Additionally, because some of the PDFs have very similar names (e.g. P511_baseline and P551_baseline), to reduce the chances that the user is looking at the wrong PDF when performing the quality check, it is essential that only one PDF is open at a time. Ideally, I would like to find a solution(s) that work for PC and Mac because this app will be used on both systems.
Most of the Matlab Answers I have seen so far are about reading data from PDFs. I do NOT need to read any data from the PDFs. I just want them to open so the user can look at them visually - this could be in a PDF application (e.g. Adobe Acrobat, Preview, etc.) or as some kind of image file within Matlab - but I do need the ability to open and close each one individually. I would appreciate any suggestions anyone has for how to do this!
Thanks.

  0 Comments

Sign in to comment.

Answers (1)

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi on 21 Apr 2020
Hi,
You could use 'open' function to open a .pdf file in adobe. For more information on this function refer to the following link
There is no direct function to close an opened pdf file as it is opened in some other application. After your tasks with the file are done, probably closing adobe might serve as a work around. You could do so as mentioned at the below link
This is a work around if you could work on windows.

  0 Comments

Sign in to comment.

Products


Release

R2019b