subroutine RTI_VSPRINTER_CUTEPDF(pdfPrinterName, pdfOutputName, destFilePath, bDoCopy, bPostGeneration)
/* --------------------------------------------------------------------------


     PURPOSE    : Sample "helper" routine to generate PDF Output from OIPI "Classic" in 10.0.x using CutePDF Writer

     AUTHOR     : Bryan Shumsky

     CREATED    : September 23, 2020

     REVISION HISTORY           (Most CURRENT first) :

     DATE        IMPLEMENTOR     FUNCTION
     --------    -----------     ------------------------------------------------------------------------------------------------
     MM-DD-YY    initials        Modification
     11-19-20    bzs             Allow for "post generation" flag
     
     
-------------------------------------------------------------------------- */
* CutePDF (v4.0+) allows you to specify a location for PDF output
* HKEY_CURRENT_USER\Software\CutePDF Writer\
* BypassSaveAs (string value): 0=no/1=yes
* OutputFile (string value): full path and file name
* bPostGeneration (string value): 0=no (pre)/1=yes (post)

If Assigned(bPostGeneration) Else bPostGeneration = ""

Declare Function REGISTRY_METHOD

Begin Case
     Case bPostGeneration = "1"
          * PDF generation should be complete - do we need to do anything?
          * Delay for a few seconds so it can "wrap up" processing
          call delay(2)
          
     Case 1
          * called before PDF generation has happened 
          * set us up for processing
          rslt = registry_method("WRITE", "HKEY_CURRENT_USER\Software\CutePDF Writer\BypassSaveAs", "1")
          rslt = registry_method("WRITE", "HKEY_CURRENT_USER\Software\CutePDF Writer\OutputFile", destFilePath)

          * set bDoCopy to 1 if we want OIPI to copy from pdfOutputName to destFilePath
          * set bDoCopy to 0 if our helper program means no copy is necessary

          bDoCopy = 0
End Case

Return 0
