Rick -
I have been testing Web Connection 7.0 on a couple of Vultr instances, selecting Windows 2012 R2 x64 as the OS. I used several of the Chocolatey calls and other PowerShell scripts from your blog post West Wind Server Migration Done - that is a very informative and useful writeup.
I'm not exactly sure, but I think it was during my initial Web Connection 7 installation process that an error happened - pretty much everything got configured automatically and the demo web app started up, also opening the localhost/wconnect test page.
However, there was an error message displayed about the printer driver. I failed to get a screenshot, but it seems there was a large red 'X' icon and error message displaying in a stand-alone dialog, which may have been fired from the VFP demo app starting up.
Still, the localhost\wconnect demo links worked, except for "Print PDF Report", in which case the VFP app displayed a WAIT message of "Error accessing printer spooler".
I'm pretty sure this all stems from the fact that the PostScriptPDFPrinterDriver setting in the (MyAppMain).INI file gets defaulted to..
Postscriptpdfprinterdriver=Microsoft Print to PDF
The "Microsoft Print to PDF" printer driver isn't installed with Windows 2012 R2, and from the (minimal) research I've done, and it can't be added for that OS.
A fresh Vultr Windows 2012 instance only has one printer installed by default - "Microsoft XPS Document Writer".
I did try your VFP menu option "Web Connection / Tools / Install PostScript Printer", and it successfully installed a "Xerox PS Class Driver" driver, which is a commented-out option in the INI file.
The default PostScriptPDFPrinterDriver for a new WC7 installation may need to be tied to the OS version?
- Mike McDonald
Yes the Microsoft PDF Driver only is available for Server 2016+ and Windows 10. For older OS's you'll have to use a different engine - the previous default was wwGhostscript with the Xerox PostScript driver.
Which goes with what OS is complex because each OS version has different drivers, so at this point going forward I decided I'll just use the Microsoft PDF driver. Most people don't install the dev version of Web Connection on a server, but they'll use a client machine and chances are that by now the majority will be using Windows 10.
IAC, the driver was always subject to configuration...
FWIW, if you're installing new servers I'd recommend always going with the latest Windows Servers available just to prolong service lifetime. Server 2012R2 and 2016 are very similar. 2019 is out now although I haven't looked at it, but my thinking is that for what we do with servers (running IIS) - nothing really changes going forward.
+++ Rick ---
Just to follow up on this and the reasoning behind the way it works.
I just took a look to see if there's a way to be smarter about what gets installed, but there are many problems with printer installation because no matter what you do there are dependencies. The Microsoft PDF Printer Driver
is the first driver that comes in the box and can just work without further configuration which is why I decided to set this up as a the default.
The problems with detection are:
Really hard to determine OS accurately. Windows no longer reports version numbers in a sensible way everything from 2012 and Win10 forward reports 6.2 in FoxPro and Windows 10 using the Win Version APIs.
Printer handling in Web Connection requires both a Printer Driver and wwPDF implementation (which is preset in code or specifically in wconnect.h). Changing that at install time is a pain. So changing from the defaul MS driver to a Post Script printer also requires switching to GhostScript or the Distiller PDF implementation.
The setup program isn't meant to be run on a server - it's for a development setup on a client and 90% of those installs will be on a Windows Desktop client and hopefully by now the majority of developers are using Windows 10 (or will be going forward).
Playing the odds here for future proofing Windows 10 and Server 2016+ are a good choice as opposed to requiring a GhostScript install and PostScript driver.
You can still manually set up a different printer driver.
To go to Ghostscript and a PostScript driver involves:
- Installing Ghostscript (GPL is best)
- Running the Printer install either from WC menu or from Console command line
- Changing the PDF class used in
wconnect_override.h
There are detailed instructions here:
For reference here are the configuration steps for the Microsoft PDF driver or the Generic Printer Driver that should work with PDF printer driver that supports direct file output (Nitro, FoxIt etc.).
+++ Rick ---
Mike,
I have the same problem with Server 2012 but I have fixed it in a few minutes without pain. Just download PDF Architect 6 from https://www.pdfforge.org/pdfarchitect. Once installed, go into Printer Properties and rename it to "Microsoft Print to PDF". Web Connection 7.02 now generated PDF as if the real Microsoft driver was installed 😃
Peter Hui
Peter you don't have to rename it - just change the Postscriptpdfprinterdriver
in your <yourApp.ini>
:
[Main]
...
Postscriptpdfprinterdriver=Microsoft Print to PDF
xPostscriptpdfprinterdriver=Xerox PS Class Driver
in wconnect_override.h
:
#UNDEFINE WWC_WWPDF
#DEFINE WWC_WWPDF wwPdfPrinterDriver
*#DEFINE WWC_WWPDF wwXFRX
*#DEFINE WWC_WWPDF wwGhostScript
*#DEFINE WWC_WWPDF wwPdfAmyUni
and then use:
*** WWC_WWPDF is defined in WCONNECT.H
*** or you can override it in wconnect_override.h
*** wwMicrosoftPdf, wwGhostScript, wwXFRX, wwAmyUni
oPDF=CREATEOBJECT([WWC_WWPDF])
*** Specify which printer driver to use for PostScript output with GhostScript
oPdf.cPrinterDriver = Server.oConfig.cPostScriptPdfPrinterDriver
...
All this stuff is configurable. Maybe we should make this even a little more easy by adding the PDF driver class into the app.ini
file as well so it's easy to see and change without a recompile.
Here's more info from the docs:
+++ Rick ---
Peter,
So I gave PDF Architect a look, but I haven't any luck making it work. Well, it works but the PDFs it generates aren't viewable.
I installed the PDFCreator
printer driver and it prints a PDF without user interaction and it works quickly, which is all great. However, the output produced won't display in any viewer including in PDF Architect.
Running the same output to the Microsoft Print to PDF
driver works fine.
Are you getting this to work?
+++ Rick ---
Rick,
There are various reasons for PDF files to be unreadable with Adobe Reader. See https://windowsreport.com/pdf-files-wont-open/
I am able to reproduce the your error when viewing a PDF Architect 6 generated PDF file with an old Adobe Reader XI v11.0.08 of year 2012. The same PDF opens ok on the latest Adobe Reader DC.
When I used the workaround by renaming the printer driver, the test page's PDF output was viewable on Chrome, MS Edge, Safari on PC and Mac, Android smartphones, Sony Smart TV, iPad and iPhone. The downloaded PDF is also readable with version 19 of Adobe Reader DC. So I am pretty happy with it.
I would love to see if it works for Mike McDonald.
Peter Hui
PDF Architect doesn't work for me in any viewer that I have (I don't use Adobe Acrobat).
I've tried viewing the result in:
- Chrome, FireFox, Edge
- Nitro
- PDF Architect
None of them display the result so there's clearly some issue with the file. I'm running the stock example from wwdemo.prg
and the test page.
The file generated looks like a PDF document - it has the right text/header and encoding and it all looks good, but it doesn't display.
Could be the embedded image perhaps... I dunno. There are probably other choices that work better.
If anybody finds a generic PDF printer that just works please post on this thread so we can reference it. There are a few considerations:
- Simple install
- Works as a PDF Printer
- Doesn't pop up a printer dialog
- Needs to allow use on a Server per license
Any that work even if commercial would be useful. So far I haven't found anything that just works with the generic wwPdfPrinterDriver
other than the Microsoft Print to PDF driver which is a good choice for WIndows 10 - Server 2016/2019.
+++ Rick ---
Let's not forget XFRX is also a great PDF solution! I have been using it for many years and the OS version has never mattered. They just released another new version with lots of additional power. It can be found at Eqeus.com
Yes definitely - if you are printing tons of PDF content I would highly recommend XFRX because it produces PDF much quicker than the other solutions that are based on a printer driver in Windows. It also avoids race conditions of multiple Web Connection instances trying to print at the same time - the Windows Print Spooler is a single queue that can only process one print job at a time, so for busy apps producing PDF that's a problem.
XFRX (and a few other FoxPro based drivers) completely build the PDF output using native code that runs inprocess which is much faster and not susceptible to the queuing of the print spooler.
+++ Rick ---
Hi Peter,
how do you rename "PDF Architect" ? I'm in WS2012R2. Already got PDFCreator (not Architect). Now, as cannot use Microsoft Print to PDF, following your suggest I update PDFCreator and it install also Architect ver.8. But, in Control Panel - Printer it do not shows Architect, just Creator. Do you have some tips. thanks Mauri
I don't quite follow what you're asking. The name of the printer driver can be changed in Windows by going the Device List and giving it a name.
If you're using wwPdf
you can specify the name of the printer driver to use for PDF generation. If you're using something else, it too should support a printer driver, unless - like XFRX - it generates the PDF natively.
+++ Rick ---
Installed PDF Architect, but it do not shows in Printer page. I see only PDFCreator. see here Thanks
OK, now I'm able to see 'PDF Architect' in printer driver list. Rename it. Works as expected in desktop environment. I should use it in webserver applet (cgi) on Apache. Unfortunately in this case it do not works. My applet returns 'memory access violation" error when assign printerName.
I don't have no idea what PDF Architect is but it has to be a PDF driver that allows specifying a file name... Not all drivers support that. You should be able to directly print to that driver if it works - try it from FoxPro with a filename and see what happens.
+++ Rick ---