I want to make a multi-device software with godot engine and I want to make it as lite as I can, so I just want to use a Line edit node and a button for saving the text but, is there any way to save it as .txt and .pdf files with code or I need an extra plugin?
Asked
Active
Viewed 508 times
0
-
Strick's answer is good, but I suggest you also research a bit about what a JSON file is. Depending on what you are doing, a JSON file can help you more easily manage your data. If you ever need to read your data back into your app, JSON is the way to go. – kojow7 Aug 04 '20 at 06:19
1 Answers
2
Writing a plain text file is relatively easy:
var file = File.new()
file.open("user://some_file.txt", File.WRITE)
file.store_string("Some text")
file.close()
PDF is more difficult. I don't think that there are any out of the box solutions. But remember that PDF is also just a text file with specific commands embedded into the text. You would have to study the specifications of a PDF file and then generate the required structures yourself via the method described above.

Strick
- 545
- 1
- 4
- 12
-
-
@MarsupialEntertainment I gave you an example of how to save a txt file in my answer. – Strick Aug 04 '20 at 06:15