0
votes

I am hoping to get some help with a work problem I recently "inherited"... The company I am working for has rendered my services to help them get their information system application migrated from Windows XP machines to Windows 10 machines. The core components of the program were developed in Visual Basic 6, Crystal Reports 8, and Adobe Acrobat 5. I already know 99% of peoples answers are along the lines of "You need to upgrade" or "Why are you using that?!". For those people, the answer is simply because my immediate need is to use what I was given, and the eventual plan is to migrate everything over to newer versions of these core components.

I have made some code adjustments already and found some other updated drivers for other dependencies, and so far through initial testing, it seems the application is performing as expected.

Unfortunately, yesterday, I hit a major snag where the application is trying to print to the "Adobe PDFWriter" printer, which doesn't seem to be installed on Windows 10, even though I installed Adobe Acrobat 5.0, as administrator, with the "Include PDFWriter files" option checked during install.

  • I can't find the printer in the list of printers.
  • I can't find any specific ports or drivers for Adobe when trying to manually add the printer.
  • The main PDFWriter dll, "pdfddui.dll", and supporting dlls, ("pdfdd.dll", "pdfkd.dll") do not exist under the "Windows\System32\spool\drivers" location, which is where they are found on a working Windows XP machines.
  • The main dlls and supporting dlls mentioned above DO exist under "Windows\System32\spool\drivers\x64"
  • When searching the registry for the main dll or supporting dlls, nothing is found, suggesting the dlls weren't able to successfully register.
  • When trying to manually register the dlls using "\Windows\SysWoW64\regsvr32.exe" it fails.
  • When trying to manually register the dlls using "\Windows\System32\regsvr32.exe" it fails.

The code that is executing is doing the following:

  • It dynamically builds a crystal report from a SQL query based on parameters from a form.
  • It uses the crystal reports "SelectPrinter" function to specify the Printer.DriverName, Printer.DeviceName, Printer.Port
  • It uses the crystal reports "PrintOut" function to specify not to prompt the user for any input, i.e. "silent print".

The end result, what I need to replicate, and what I need the communities help with is that Crystal Reports:

  • Prints the file as a PDF SILENTLY with NO user action required.
  • Prints the file with a specific filename.
  • Prints the file to a specific location.

I have tried using Microsofts built-in Print to PDF, and that works, BUT it prompts the user to save the file, it also has the wrong default filename and location, and I see no way to programmatically change that from VB6.

I would imagine newer versions of Adobe Acrobat ARE NOT compatible with Visual Basic 6, additionally, the licenses for Adobe Acrobat are kind of pricey when the ONLY functionality I need is the ability to programmatically print to PDF.

Any useful comments, suggestions, resolutions will be very much appreciated!

1
Just stop. You're not going to be able to make the Acrobat 5 print driver work under Windows 10. You're going to have to skip over the part where you "use what I was given" and jump right to "migrate everything over to newer versions". When the application was created, there were no good command line tools to print a PDF reliably. Now there are... several... and you need to use one of those instead. If your client isn't open to that idea, drop them. Also, I'm not one iof the 99%, I was a product manager on Acrobat 5. - joelgeraci
if You just need a PDF printer driver - specifically for VB6 programmers - I can only suggest qvPDF. It works - with some minor adjustments - in all Windows versions as local printer and as network printer as well. I used this under heavy load in production and it worked surprisingly fast and stable. Just my two cents, I am not involved in this project. But, keep on mind, as VB6 programmer, You will need to understand the source code and apply some minor adjustments, depending from Your needs. - deblocker
@deblocker thank you for taking the time to respond with something actually useful! I took a look at qvPDF, and it looks like a nice program that someone put a lot of time into, need to dig a little deeper and see if it will work for my needs. - guht
@guht: glad You appreciated. The three key-points that You specified in Your printing requirements are very common at work. I would add a fourth bullet: After the completion of every single print action, the printer should synchronously raise a callback function returning the full name of the generated file. - deblocker

1 Answers

0
votes

Why don't you add an intermediate, behind-the-scenes, step to export the Crystal Report to a PDF file and then print the PDF file using ShellExecute or another method.

pid = ShellExecute(0&, "print", DocFile, vbNullString, vbNullString, vbNormalFocus) is what I use to print PDF files automatically from VB6.

If that doesn't work, I have used a printer driver called CutePDF. It is free and Windows 10 ready.