Creating pdfs from text field contents

How can I add the contents of text fields that the user added, to a form of some kind so it can be printed or viewed as PDF?

The answer is - of course - yes. But it really depends on what exactly you want to do and if you want to spend money. You should have at least a look at the built-in PDF classes. Both Einhugur and MBS have a plugin with way more capabilities. My own app uses a html viewer to create PDFs out of a html template.

All I need is the content of different text fields to be gathered into a single PDF.

https://blog.xojo.com/2020/08/27/pdf-arrives-at-xojo/

https://documentation.xojo.com/api/pdf/pdfdocument.html

Since we have no other data than you want to put text fields into a PDF document try the links above. If you get stuck then post the code you are trying to do this with and perhaps someone can be of more help.

You can read articles on Xojo’s blog: Search Results for “pdf” – Xojo Programming Blog
You can see the examples in: Examples - Topics - PDF (if you have Xojo 2022r2, different path in other versions)
image

There should be videos too on Xojo’s YouTube channel.

That literally could be anything. My html to pdf is also “only a couple of field” - more or less.

Thanks! The PDFDocument class is I think what I am looking for. Looks very easy to use.

1 Like

I am working on creating the PDF exports following the above link but am wondering what is the difference in creating a PDF layout this way, or with the (Insert) Report method where you can create the layout on a canvas.

What do you want to do ?

Look at the Documentation for Report and PDFDocument and decide what you have to do for your software.

If this is a rhetorical question, there is no answer (or “it depends on your software”)…

I am confused in how to approach what I need, because I see ways to create PDFs with the PDFDocument method, but then also see a Report Layout editor and I don’t understand how they relate or what I should use.

What I would like is this: Get the text that is filled into the text fields by the user and export them to a PDF. For example in this Window there are 3 fields showing, I would like these “Answers” see on a PDF.

Have-you looked at the Examples folder / search for reports there ?

Report from SQL Query.xojo_binary_project
Report Preview via Container Control.xojo_binary_project
Report Using Groups.xojo_binary_project

https://documentation.xojo.com/api/printing/reporting/report.html#report

I never used it, but apparently, this works with data base Records… But nearly anything can be set into a data base.

Best advice: look at the examples (load, run, understand and decide).