Aprire PDF presente sulle risorse dell'app

Ciao a tutti, vi chiedo un aiuto su una cosa che non riesco a capire come fare pur avendo cercato e testato tante alternative. Vorrei poter apire un file Pdf che è presente all’interno della mia app e mostrarlo su un HTMLWiever. Nel codice qui sotto come potrete capire riesco a mostrare il file Pdf ma se questo è già salvato e presente sul desktop del Mac. Io sto sviluppando un app per alcune persone e volevano appunto avere questa possibilità di avere il pdf presente solo all’interno dell’app. So benissimo che non si usa fare così ma devo stare alle cose che mi vengono rischieste.

Il codice che uso per aprire un file pdf presente sulla scrivania del Mac è questo:

//Ottieni il Pdf
dim f as FolderItem = SpecialFolder.Desktop.Child("manuale.pdf")

// apri Pdf
f.launch

// mostra Pdf in app
HTMLViewer1.LoadPage f

Grazie della vostra attenzione e buona giornata a tutti.

If you want to launch the PDF from your app, then you need a copy files build step. Click on Insert → Build Step → Copy Files. Make sure that the build step is at the correct location. Drag your PDF to the middle of the window:

On the right side make sure that Applies to is set to Both and the Destination needs to be the Resources folder.

Now you can refer to your added files in code as child of the Resources folder with Specialfolder.Resources.Child(“your filename here”).

HTH

1 Like

Thank you so much Beatrix for your precious help and kindness. I knew I could count on people who were knowledgeable about Xojo and I’m happy you helped me. Works :)))))

1 Like