On May 6, 2019, at 2:00 PM, Doug Cottril wrote:

> Julio & all
> 
> That does indeed, work.  However, the SW_Hide parameter does not seem to 
> suppress the print
> dialogs.  Since I actually need to print multiple documents at once, the user 
> does not want to
> press the print button after every page (and there could be 50+ pages, so I 
> don’t blame them)
> 
> I’ll read the docs a bit and the resource Chip posted, but if anyone has beat 
> their head against
> this wall before and either has a solution, or knows there isn’t one, I’d 
> appreciate hearing
> about it.

You appear to have several options:

PDFtoPrinter    http://www.columbia.edu/~em36/pdftoprinter.html  Have not used 
it, just found it with Google.

Foxit Reader    https://www.foxitsoftware.com/pdf-reader/    Have not used it, 
just found it with Google.

Acrobat Reader using “officially undocumented” command line interface.  This is 
the one I built and used many years ago. Not sure if it still works in the 
current version of Acrobat Reader. You will have to test it to see if it still 
works.

Here is some sample code initially written back in 2007. Yikes!!  But you can 
see it supports Acrobat Reader from version 5.0 to 10.0. But you will get the 
docs on the command line parameters. (I found this doing Google searches long 
time ago.)

  // ===========================================
  // PROJECT METHOD: ExpenseReport_PrintReceipts

  // PARAMETERS: $1 = full path to PDF file to print

  // DESCRIPTION: Called form PrintExpenseReport method to print a PDF file
  // of receipts.  

  // This method uses the partially documented -- and unsupported -- way of 
getting
  // Adobe Reader to print a PDF file without displaying print dialogs to the 
user.

  // Command Line Parameters:
  //      /p = displays the Print Dialog box  (but my testing shows it does not 
always show dialog box)
  //      /t = prints without dialog box (but you need to also include the 
printer name parameter)
  //      /n = Launches a separate instance of Acrobat or Adobe Reader, even if 
one is currently open.
  //      /s = Opens Acrobat or Adobe Reader, suppressing the splash screen.
  //      /o = Opens Acrobat or Adobe Reader, suppressing the open file dialog.
  //      /h = Opens Acrobat or Adobe Reader in a minimized window.

  // CREATED BY: Tim Nevels, Innovative Solutions ©2007
  // DATE: 9/20/2007
  // LAST MODIFIED: 
  // ============================================

C_TEXT($1;$documentPath_t)
$documentPath_t:=$1

$OKtoContinue_b:=True

If (<>MacOS)
        Msg ("Printing receipt PDF files is currently not supported for Mac OS 
X.")
        $OKtoContinue_b:=False
End if 

  // get path to Adobe Reader
If ($OKtoContinue_b)
        $adobeReaderProgramPath_t:="C:\\Program Files\\Adobe\\Reader 
10.0\\Reader\\AcroRd32.exe"
        If (Test path name($adobeReaderProgramPath_t)#Is a document)
                $adobeReaderProgramPath_t:="C:\\Program Files\\Adobe\\Reader 
9.0\\Reader\\AcroRd32.exe"
                If (Test path name($adobeReaderProgramPath_t)#Is a document)
                        $adobeReaderProgramPath_t:="C:\\Program 
Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe"
                        If (Test path name($adobeReaderProgramPath_t)#Is a 
document)
                                $adobeReaderProgramPath_t:="C:\\Program 
Files\\Adobe\\Reader 7.0\\Reader\\AcroRd32.exe"
                                If (Test path 
name($adobeReaderProgramPath_t)#Is a document)
                                        $adobeReaderProgramPath_t:="C:\\Program 
Files\\Adobe\\Acrobat 7.0\\Acrobat\\Acrobat.exe"
                                        If (Test path 
name($adobeReaderProgramPath_t)#Is a document)
                                                
$adobeReaderProgramPath_t:="C:\\Program Files\\Adobe\\Acrobat 
5.0\\Acrobat\\Acrobat.exe"
                                                If (Test path 
name($adobeReaderProgramPath_t)#Is a document)
                                                        Msg ("ERROR: Unable to 
locate Adobe Reader application."+<>CR+<>CR+"Please locate the program.")
                                                        $docRef:=Open 
document("";"APPL";Get pathname)
                                                        If (OK=1)
                                                                
$adobeReaderProgramPath_t:=Document
                                                        Else 
                                                                
$adobeReaderProgramPath_t:=""
                                                        End if 
                                                End if 
                                        End if 
                                End if 
                        End if 
                End if 
        End if 
        
        If ($adobeReaderProgramPath_t="")
                Msg ("ERROR: Unable to print Receipts PDF file.  The Adobe 
Reader application could not"+" be found.")
                $OKtoContinue_b:=False
        End if 
End if 


  // get current printer name
If ($OKtoContinue_b)
        $printerName_t:=Get current printer
End if 


  // issue the print command to Acrobat Reader
If ($OKtoContinue_b)
        $documentPath_t:=Char(Double quote)+$documentPath_t+Char(Double quote)
        $adobeReaderProgramPath_t:=Char(Double 
quote)+$adobeReaderProgramPath_t+Char(Double quote)
        
          // handle special command line parameters for different Adobe versions
        Case of 
                : (Caps lock down)  // %%%%%%%%%%%% Debugging Code %%%%%%%%%%%%
                        $commandLineParameters_t:=" /p /h /s "
                        $userInput_t:=Request("Enter command line 
parameters:";$commandLineParameters_t)
                        If (OK=1)
                                $commandLineParameters_t:=$userInput_t
                        End if 
                          // %%%%%%%%%%%% Debugging Code %%%%%%%%%%%%
                        
                : ($adobeReaderProgramPath_t="@Reader 10.0@")
                        $commandLineParameters_t:=" /t "
                        
                : ($adobeReaderProgramPath_t="@Reader 9.0@")
                        $commandLineParameters_t:=" /t "
                        
                : ($adobeReaderProgramPath_t="@Reader 8.0@")
                        $commandLineParameters_t:=" /t "
                        
                Else 
                        $commandLineParameters_t:=" /p /h /s "
        End case 
        
        SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"true")
        
        LAUNCH EXTERNAL 
PROCESS($adobeReaderProgramPath_t+$commandLineParameters_t+$documentPath_t+" 
"+$printerName_t)
End if 

Tim

*****************************************
Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.com
*****************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to