{"id":124,"date":"2008-09-06T15:06:00","date_gmt":"2008-09-06T15:06:00","guid":{"rendered":"\/lisa\/post\/2008\/09\/06\/How-to-ruin-a-weekend-(or-Endless-Vistas).aspx"},"modified":"2021-08-30T13:30:52","modified_gmt":"2021-08-30T20:30:52","slug":"how-to-ruin-a-weekend-or-endless-vistas","status":"publish","type":"post","link":"https:\/\/spacefold.com\/lisa\/2008\/09\/06\/how-to-ruin-a-weekend-or-endless-vistas\/","title":{"rendered":"How to ruin a weekend (or: Endless Vistas)"},"content":{"rendered":"<p align=\"left\"><a title=\"Adrian is today's lucky winner\" href=\"mailto:Adrian%20Paterson-Roos%20[APaterson-Roos@oceaneering.com\" target=\"_blank\" rel=\"noopener\">Adrian Paterson-Roos<\/a> wrote plaintively (and you&#8217;d &#8216;plaint too):<\/p>\n<blockquote><p>I am trying to create PDF&#8217;s on an &#8220;In house System&#8221; using\u00a0MS Fox Pro, we originally used your suggestion of the Apple Color printer, which worked fine in XP, but since testing in VISTA, it&#8217;s all gone wrong. I have looked at your posting (<a href=\"http:\/\/www.spacefold.com\/articles\/pdfpower\/\">http:\/\/www.spacefold.com\/articles\/PDFPower<\/a>), which gave some clues, but even trying to use alternative Printer drivers listed in <a href=\"http:\/\/www.spacefold.com\/articles\/pdfpower\/\">http:\/\/www.spacefold.com\/articles\/PDFPower<\/a>, all I get are blank PDFs.<\/p>\n<p>Have you done any work with VISTA and if so, can you put me out of my misery?<\/p><\/blockquote>\n<p>Dear god, yes I have done work in Vista. In fact, I bruised my fingers writing two white papers for MS during the Vista beta.\u00a0\u00a0I breathed, dreamt, and ate Vista for a period of months, to do it.<\/p>\n<p class=\"NB\">I&#8217;m not sure what happened to the white papers, or where they might be published, so I can&#8217;t reference them for you here. They were not\u00a0entirely complimentary, and I presented them before\u00a0this was a fashionable attitude. Maybe the attitude\u00a0had nothing to do with it, and just the VFP-slant on integration and interop\u00a0got them buried.<\/p>\n<p>Or maybe the papers\u00a0were just cr*p. I don&#8217;t think so, though, since a very similar approach to the one I took in the XAML-oriented paper\u00a0turned\u00a0up in <a title=\"MSDN VB6 Interoperability and Migration\" href=\"http:\/\/msdn.microsoft.com\/en-us\/vbasic\/ms789185\/\" target=\"_blank\" rel=\"noopener\">recommendations for VB6 and the Interop toolkit<\/a>, including remarkably similar terminology, later.\u00a0 I&#8217;m not saying at all that they got the idea from me, just that I can&#8217;t have been too far off the mark.<\/p>\n<p>In any case, GhostScript is really environment-independent and therefore works as well under Vista as under XP, so as far as I knew PdfListener and PdfClass did too.\u00a0 I suspected that Adrian&#8217;s blank PDFs were the product of a permission problem, that some errors were being swallowed, and GS, when invoked, didn&#8217;t have PS source files to work on.<\/p>\n<p>I easily verified this as a potential problem by spelunking around in google for a few minutes (I think I searched for &#8220;postscript Vista&#8221; or something like that.)<\/p>\n<p><a title=\"Sample help-where's-my-driver post\" href=\"http:\/\/www.vistax64.com\/vista-print-fax-scan\/63425-looking-postscript-driver-generic-vista.html\" target=\"_blank\" rel=\"noopener\">Some posts<\/a> were yet more plaintive cries, just confirming there was a general issue. <a title=\"It's not just printer drivers\" href=\"http:\/\/blog.roblevine.co.uk\/?p=22\" target=\"_blank\" rel=\"noopener\">Others<\/a> really made me want to throw up my hands in disgust and forget the whole thing (not because the posts were horrible but because the problem is so endemic and so deep).\u00a0 But <a title=\"Aha! Maybe there's hope?\" href=\"http:\/\/blog.schappy.de\/archive\/2007\/04\/29\/wmf2eps-for-vista\/\" target=\"_blank\" rel=\"noopener\">a few<\/a> gave me pointers on how to fix the thing, and I returned to these later on.<\/p>\n<p>I started a from-scratch &#8220;transparent&#8221; install to see what could be wrong and immediately ran into what you see below.\u00a0 This activity ordinarily happens during the\u00a0 .VerifyPrinterSetup method in both PdfListener and PdfClass, but\u00a0in this screenshot\u00a0I&#8217;ve extracted it to the command line so you can see clearly that we&#8217;re not in GhostScript territory when the error occurs:<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 550px; height: 336px;\" title=\"Vista not liking it\" src=\"\/lisa\/wp-non\/migrated\/pdfVista1.png\" alt=\"Vista not liking it\" width=\"550\" height=\"336\" \/><\/p>\n<p align=\"left\">To give\u00a0MS credit, they&#8217;re really telling you exactly what&#8217;s wrong here.\u00a0 The <strong>ntprint.inf<\/strong>\u00a0that I&#8217;m invoking, and that comes with Vista, doesn&#8217;t have the information it needs to do what you&#8217;re asking it to do.<\/p>\n<p align=\"left\">My Vista computer originally had XP on it.\u00a0 It has a <strong>C:\\I386<\/strong> folder with a different <strong>ntprint.inf <\/strong>file in it, with all the instructions you need to install the Postscript base files and their association with the PS printer name I happen to have specified (in this case, <strong>Apple Color LaserWriter 12\/600<\/strong>).\u00a0 So all I really had to do to fix this was to make a small change in PdfListener&#8230; from:<\/p>\n<p class=\"code\"><span style=\"font-family: Courier New; font-size: small;\">#<\/span><span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">DEFINE <\/span><span style=\"font-family: Courier New; font-size: small;\">DRIVER_TO_USE &#8220;Apple Color LaserWriter 12\/600&#8221;<\/span><\/p>\n<p><span style=\"font-family: Courier New; font-size: small;\"><span style=\"font-family: Courier New; font-size: small;\">lcCmd =\u00a0[%windir%\\\\system32\\\\rundll32.exe ] + ;<br \/>\n[printui.dll,PrintUIEntry \/if \/b ] + ;<br \/>\n[&#8220;] + <span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">THIS<\/span><span style=\"font-family: Courier New; font-size: small;\">.PSDriverSetupName + [&#8220;] + ;<br \/>\n[ \/f %windir%\\\\inf\\\\ntprint.inf \/r &#8220;lpt1:&#8221; \/m &#8220;] + ;<br \/>\nDRIVER_TO_USE + [&#8221; \/Z] <\/span><\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&#8230; to<\/p>\n<p class=\"code\"><span style=\"font-family: Courier New; font-size: small;\">#<\/span><span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">DEFINE <\/span><span style=\"font-family: Courier New; font-size: small;\">DRIVER_TO_USE &#8220;Apple Color LaserWriter 12\/600&#8221;<\/span><br \/>\n<span style=\"font-family: Courier New; font-size: small;\">#<\/span><span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">DEFINE <\/span><span style=\"font-family: Courier New; font-size: small;\">NTPRINT_INF_LOC &#8220;C:\\\\I386\\\\&#8221; <\/span><br \/>\n<span style=\"font-family: Courier New; font-size: small;\"><br \/>\nlcCmd =\u00a0[%windir%\\\\system32\\\\rundll32.exe ] + ;<br \/>\n[printui.dll,PrintUIEntry \/if \/b ] + ;<br \/>\n[&#8220;] + <\/span><span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">THIS<\/span><span style=\"font-family: Courier New; font-size: small;\">.PSDriverSetupName + [&#8220;] + ;<br \/>\n<\/span><span style=\"font-family: Courier New; font-size: small;\">\u00a0\u00a0 [ \/f ] + NTPRINT_INF_LOC + [ntprint.inf \/r &#8220;lpt1:&#8221; \/m &#8220;] + ;<br \/>\nDRIVER_TO_USE + [&#8221; \/Z]<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&#8230; and if the\u00a0old files\u00a0could be assumed to be\u00a0available, that would do it.<\/p>\n<p>Of course, in PdfListener, we don&#8217;t assume the files are available.\u00a0 You already know what we do to install the GS files: we stick them all in an <strong>INSTALL.DBF<\/strong> and pop them out at runtime.\u00a0 There&#8217;s no reason in the world why you can&#8217;t do the same thing for the old <strong>ntprint.inf<\/strong> file and the relevant postscript driver files from some XP install, if you want.<\/p>\n<p>The relevant code might now look something like this:<\/p>\n<p class=\"code\"><span style=\"font-family: Courier New; font-size: small;\">#<\/span><span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">DEFINE <\/span><span style=\"font-family: Courier New; font-size: small;\">DRIVER_TO_USE &#8220;Apple Color LaserWriter 12\/600&#8221;<\/span><br \/>\n<span style=\"font-family: Courier New; font-size: small;\"><br \/>\nlcCmd = [%windir%\\\\system32\\\\rundll32.exe ] + ;<br \/>\n[printui.dll,PrintUIEntry \/if \/b ] + ;<br \/>\n[&#8220;] + <\/span><span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">THIS<\/span><span style=\"font-family: Courier New; font-size: small;\">.PSDriverSetupName + [&#8220;] + ;<br \/>\n<\/span><span style=\"font-family: Courier New; font-size: small;\">\u00a0\u00a0 [ \/f ] + <span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">THIS<\/span><span style=\"font-family: Courier New; font-size: small;\">.GSLocation + [ntprint.inf \/r &#8220;lpt1:&#8221; \/m &#8220;] + ;<br \/>\nDRIVER_TO_USE + [&#8221; \/Z]<\/span> <\/span><\/p>\n<p align=\"left\">\n&#8230; and of course if life were simple in Vista-land, that would do it.<\/p>\n<p align=\"left\">The reason it&#8217;s not simple, as you can probably guess, is that these old drivers are not signed.\u00a0 Once you take them out of an &#8220;expected&#8221; location such as <strong>C:\\I386<\/strong>, you&#8217;re likely to see something like the following &#8212; which is hardly a &#8220;transparent&#8221; installation of your branded PDF driver:<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 489px; height: 173px;\" title=\"Uh-oh. User's not going to have a clue when they see this dialog confirming installation of Apple Color LaserWriter, a printer they don't have.\" src=\"\/lisa\/wp-non\/migrated\/pdfVista2.png\" alt=\"Uh-oh. User's not going to have a clue when they see this dialog confirming installation of Apple Color LaserWriter, a printer they don't have.\" width=\"489\" height=\"173\" \/><\/p>\n<p align=\"left\">So, what to do?<\/p>\n<p align=\"left\">First, get yourself a signed PostScript driver.\u00a0 (Don&#8217;t forget to use one that supports at least one color printer model, if you want color PDFs.)\u00a0 I got mine <a title=\"Xerox 700 Digital Color Press Drivers and Downloads\" href=\"http:\/\/www.support.xerox.com\/go\/results.asp?Xtype=download&amp;prodID=700_DCP&amp;Xlang=en_US&amp;Xcntry=USA\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p align=\"left\">Change your DRIVER_TO_USE value to something that matches the materials you downloaded (for the one I used, an appropriate value was <strong>Xerox 700 Integrated Color Server PS<\/strong>) .\u00a0 You will usually have to change the name of the <strong>.inf<\/strong> file to match whatever file goes with this set of installation files, too.<\/p>\n<p align=\"left\">Your resulting code, which will allow you to do the install from the location of your choice without that dialog, will look something like this, assuming you dump the driver install files in the same place as the GS files:<\/p>\n<p class=\"code\"><span style=\"font-family: Courier New; font-size: small;\">lcCmd =\u00a0[%windir%\\\\system32\\\\rundll32.exe ] + ;<br \/>\n[printui.dll,PrintUIEntry \/if \/b ] + ;<br \/>\n<\/span>\u00a0\u00a0\u00a0\u00a0 \u00a0[&#8220;] + <span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">THIS<\/span><span style=\"font-family: Courier New; font-size: small;\">.PSDriverSetupName + [&#8220;] + ;<br \/>\n[ \/f ] + <\/span><span style=\"color: #0000ff; font-family: Courier New; font-size: small;\">THIS<\/span><span style=\"font-family: Courier New; font-size: small;\">.GSLocation + OTHER_INF_FILENAME + ;<br \/>\n[ \/r &#8220;lpt1:&#8221; \/m &#8220;] + ;<br \/>\nDRIVER_TO_USE + [&#8221; \/Z]<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&#8230; and this will work.<\/p>\n<p>Of course I&#8217;m assuming you clear the usual UAC hassles and standard user permission issues in our Brave New OS World. &#8220;Work&#8221; is a relative term.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 365px; height: 202px;\" title=\"It is semi-okay for users to understand that creating a PDF is &quot;printing&quot;.\" src=\"\/lisa\/wp-non\/migrated\/pdfVista3.png\" alt=\"It is semi-okay for users to understand that creating a PDF is &quot;printing&quot;.\" width=\"365\" height=\"202\" \/><\/p>\n<p align=\"left\">But, hey, this dialog doesn&#8217;t clue them in about what driver is being installed, it&#8217;s okay for your branded &#8220;PDF driver&#8221; to show it.<\/p>\n<p align=\"left\">I&#8217;ve already mentioned this type of problem in the <a title=\"PDFPower article\" href=\"http:\/\/www.spacefold.com\/articles\/pdfpower\/\">original PdfListener article<\/a>\u00a0and if you&#8217;re doing VFP in Vista you doubtless have come up with your own approach to the general UAC and permissions hurdles.\u00a0 In this case, my personal recommendation is to run the setup program for your app under admin settings to make sure <strong>everything<\/strong> you need goes as planned, because the potential disasters are hardly limited to PdfListener&#8217;s requirements. You can include the .VerifyPrinterSetup code as part of your app setup, whether by instantiating one of my classes &#8212; the method code is designed to run outside of a report context, during setup, as well as &#8220;verifying&#8221; at report-time &#8212; or by\u00a0lifting the code.<\/p>\n<p align=\"left\">I&#8217;ll put a link from the original article to this post.\u00a0 I won&#8217;t bother to change the PRGs in the code downloads for the article, because who knows what else someone will discover before the dust settles.<\/p>\n<p align=\"left\">Happy Vistas! Now I&#8217;ll SET SARCASM OFF and take a nap.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adrian Paterson-Roos wrote plaintively (and you&#8217;d &#8216;plaint too): I am trying to create PDF&#8217;s on an &#8220;In house System&#8221; using\u00a0MS Fox Pro, we originally used your suggestion of the Apple Color printer, which worked fine in XP, but since testing in VISTA, it&#8217;s all gone wrong. I have looked at your posting (http:\/\/www.spacefold.com\/articles\/PDFPower), which gave<a class=\"more-link\" href=\"https:\/\/spacefold.com\/lisa\/2008\/09\/06\/how-to-ruin-a-weekend-or-endless-vistas\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,9],"tags":[],"class_list":["post-124","post","type-post","status-publish","format-standard","hentry","category-reporting","category-visual-foxpro"],"_links":{"self":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":1,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/124\/revisions\/394"}],"wp:attachment":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}