How to set the pdf title?

I generate a pdf (and print to printer) in a project, taking the ListBox data.

When I ask MacOS to “Open the pdf in Preview”, here’s the given title:

Apparently, the first part is the data base file name (window’s title), followed by the data base path (users…) truncated.

Is it possible to set the pdf name ?

Remember: MacOS is used to generate that pdf (I do not not Xojo’s pdf).

BTW: the text in the pdf is vectorial data.

Inside Xojo, you cannot.
It will take the name of the dialog that is foremost when the printing occurs.
Afterwards, you can modify it using external tools

if you create the PDF using DynaPDFMBS (or maybe even Xojo’s PDFDocument?) then you can set the title in code.

I change the name of the frontmost window just before calling the printer dialog, and restore it just after
it’s almost invisible to the end user and it works fine.

2 Likes

This is the only way to achieve it that I’ve found, as well since the printer dialog gets the PDF name from the title of the window that it was called from.

The actual pd name have two parts as I wrote eartier:
a. The frontmost Window (the caller’s window) title
b. the path to the application service files (users-Emile…).
I will explorate stackexchange.com.

Thank you;

Yep, with PDFDocument you can set the document title among other metadata.

2 Likes

I found why the above…

I used a declare that receive a path, so a click in the title allows me to open the folder the path points to (on MacOS). That is why I get a file name with the extension as Window’s title, followed by (a part of) the path !…

I will change, on MacOS, the window title when the user click in the rint to PDF button and set back the window’s title afterward.

Thank you all.

here on ventura 13.2.1 I just discovered that setting the window title before printing does not set the pdf title anymore on macos… this trick seems to be not working anymore…
any declare that may work ?

thanks.

If you create a new project in Xojo and choose “examples”, “Creating PDF Documents”, “Creating PDF Documents from the Desktop”, you’ll see the Title Metadata being set in here:

yeah it seems using pdfdocuments is the way to go…
I kinda liked the way you could choose to print to a printer or to a pdf file at the print dialog stage…

2 Likes

Same here…

1 Like

https://tracker.xojo.com/xojoinc/xojo/-/issues/72131

can someone try the above issue on monterey or bigsur ? thanks.