Page 1 of 1
save file into app
Posted: Fri Aug 05, 2022 12:05 pm
by mah_qethyBUShPJV
good day
I'm making car instruction step by step how to
ex how to change oil and oil filter
i already make pdf files with instruction
but i need to press button and it show the instruction
i already know to make path and open pdf but if i send the application to other the pdf will be on my laptop and it will not work with them
what can i do ?
ps. my app
1st stack car company ex( bmw , vw , Toyota ...
then it go to car model
then car year
then 6 button show ex( oil and oil filter change
Re: save file into app
Posted: Fri Aug 05, 2022 12:07 pm
by mah_qethyBUShPJV
it prefer be in app as internet access not always have
Re: save file into app
Posted: Fri Aug 05, 2022 5:07 pm
by jacque
You can store the PDF files in the app as custom properties. Do you know how to do that?
Another way is to put the files in the Copy Files pane of the standalone settings. Then they will be included in the app installation.
Re: save file into app
Posted: Sat Aug 06, 2022 8:20 am
by mah_qethyBUShPJV
thank you so much ill try it
Re: save file into app
Posted: Sat Aug 06, 2022 9:45 am
by mah_qethyBUShPJV
jacque wrote: ↑Fri Aug 05, 2022 5:07 pm
You can store the PDF files in the app as custom properties. Do you know how to do that?
Another way is to put the files in the Copy Files pane of the standalone settings. Then they will be included in the app installation.
hi i try to find tutorials for what u said but didnt find
can u refer tutorials for "You can store the PDF files in the app as custom properties. Do you know how to do that?"
i already upload pdf in standalone but dont know to to refear button to open it
Re: save file into app
Posted: Sat Aug 06, 2022 12:07 pm
by SparkOut
It is possible to store pretty much any information in a custom property. A pdf is a binary file so you would need to use the "binfile" syntax in a "url" command to get the original file.
To display it afterwards would need you to do the reverse operation and take the data in the custom property and then write it into a file on the user's device that can be read by whatever application is used for the display. (There are complications in cross-device methods, and "generally speaking" there are security reasons why displaying a local file in a browser is prevented. You can search for info on this forum.)
Code: Select all
--you need to know the full path and filename
--for the purpose of this illustration it is assumed to be stored in a variable "tFile"
put url ("binfile://" & tFile) into tDatasheet
set the cDatasheet of this card to tDatasheet
--this allows for one datasheet per card, but you can adjust the naming and storage convention to your design, however you wish
To write it out you need to use a writeable location and also a place that is readable by the display app, with the complications noted above.
Code: Select all
--you need to know the destination file path and name,
--assumed here to be stored in a variable, such as
put specialFolderPath("documents") & "/xyz.pdf" into tDatafile
put the cDatasheet of this card into url ("binfile://" & tDatafile)
launch document tDatafile --results may vary
If you are the author of the datasheets, it might be much more convenient to save them as rtf documents instead of pdf.
Then you can import them in the same way as indicated above. But instead of having to write out the file for display, with those complications, you can just display the rtfText in a field within the LiveCode app.
Code: Select all
set the rtfText of field "DatasheetView" to the cDatasheet of this card
Re: save file into app
Posted: Sun Aug 07, 2022 8:13 pm
by jacque
mah_qethyBUShPJV wrote: ↑Sat Aug 06, 2022 9:45 am
i already upload pdf in standalone but dont know to to refear button to open it
If you already incude the PDF files in standalone settings they will be stored in specialFolderPath("resources") in the app. The file name will be specialFolderPath("resources") & "/myFile.pdf". If you want to get the file content instead of just the path, use this:
Code: Select all
put url ("binfile:" & specialFolderPath("resources") & "/myFile.pdf") into tPDF