Okay, I tested it, and it really depends on whether you want to work with the free version 2.99 or version 3.
I downloaded version 2.99z41 (FoxyPreviewer v299z41.zip) and extracted it into the folder C:\Users\ChrissM\Downloads\FoxyPreviewer v299z41And I downloaded version 3.165 (FoxyPreviewer_v3.165 Distrib.zip) and extracted it into the folder C:\Users\ChrissM\Downloads\FoxyPreviewer_v3.165 Distrib
In version 2.99 the code I gave will give you what you want: A preview with a toolbar that does not show the "print report" button. There's a crux with this, because you actually DO need this button to finally create the PDF after the preview.
In version 3 using this code does not provide the FoxPro report preview feature, but opens up the PDF application associated with the PDF extension after creating the PDF file. It should be sufficient, as that should be your goal, to let the user see the PDF not just a preview of the PDF. The code for that is not needing to influence the preview windows, it doesn't even need a preview window at all, neither your own nor the FoxyPreviewer internal preview window. It creates the PDF and afterward opens it. The UI you get then depends solely on the PDF application associated with the computer. So it even reduces to a two-liner:while
Code:
Do "C:\Users\ChrissM\Downloads\FoxyPreviewer_v3.165 Distrib\FoxyPreviewer.app"
Report Form (Home()+"\TOOLS\FILESPEC\90FRX.FRX") To File ("C:\Users\ChrissM\Downloads\FoxyPreviewer_v3.165 Distrib\90frx.pdf") Preview
Both versions of FoxyPreviewer use the libhpdf.dll, by the way. This will be extracted from the foxyPreviewer app when it's needed, you don't need to add that yourself. There is another crux with this, though, if your final installed version can't write out the DLL it extracts from the APP, then this is a reason it only works in the IDE and not in the final version.
Using foxypreviewer app also comes with using FoxyPreviewer_Settings.dbf table, that should be a writable file. So overall for the final distributon, it's always best to have the app in a folder users can write to. That's a detail aspect you should also see for yourself, if you use foxypreviewer from the IDE in your first tests, because the zip does not contain the DLL. In v 2.99 you get a Source and Sample subfolder in the zip extraction and in version 3 you get no source subfolder, only the Samples and a FoxyGetImage.prg. Anything else is generated by using foxypreviewer.app
So please, pay attention and observe what happens also on the file/folder level, when you use foxyPreviewer. BEsides reading the documentation, which also tells you that and much more.
All in all it's still not necessary to have your code, you're just doing way too much and not getting what you want, as you use mechanisms like the AllowPrintFromPreview that's taken into account by the native Report engine of VFP9,
but not by FoxyPreviewer, which has its own flags for its own preview window toolbar you've been pointed to multple times already.
You first have to decide whether you want to use FoxyPreviewer or not. And then do things accordingly to documentation. You mix sample code meant for the usual report engine with Foxypreviewer samples, this won't work out.
On top of that. If your decision to use the native report engine provided with vfp9 from Microsofts, you will need a PDF printer that you have to set prior to running the report. If you use FoxyPreviewer, you don't it uses a Pdf dll. You will then need different code for version 2.99 or 3 and you either go for using the foxyPreviewer preview before actually generating the PDF or use it to generate the PDF and finally show the PDF file in whatever PDF viewer the computer has associated with the file type PDF.
Chriss
PS: find the PDF of 90frx.frx as a download link, so you see what PDF FoxyPreviewer generates using the libhpdf.dll embedded within the foxypreviewer.app.