Hi all,
I am currently printing VFP reports in sequence, then using ShellExecute to print PDFs via their default program (Adobe DC). I am trying to keep each print job in sequence so they come out in the tray together: Example:
WO #1 Drawings for WO #1 (PDF via ShellExecute)
WO #2 Drawings for WO #1 (PDF via ShellExecute)
etc.
What I'm running into is sometimes WO#2 prints out before WO#1's PDF prints from Adobe DC.
Does anyone have experience in using a Windows API to see if Adobe has printed the PDF before I can continue printing my next VFP form?
Thanks
Philip B Bison Tech Plus
This seems to be related to your need...at least the input from DSummZZZ.
https://www.tek-tips.com/viewthread.cfm?qid=833335 https://www.tek-tips.com/viewthread.cfm?qid=833335
May need to sort through the output to find what you're looking for.
Mike
Philip Borkholder wrote:
Hi all,
I am currently printing VFP reports in sequence, then using ShellExecute to print PDFs via their default program (Adobe DC). I am trying to keep each print job in sequence so they come out in the tray together: Example:
WO #1 Drawings for WO #1 (PDF via ShellExecute)
WO #2 Drawings for WO #1 (PDF via ShellExecute)
etc.
What I'm running into is sometimes WO#2 prints out before WO#1's PDF prints from Adobe DC.
Does anyone have experience in using a Windows API to see if Adobe has printed the PDF before I can continue printing my next VFP form?
Thanks
Philip B Bison Tech Plus
[excessive quoting removed by server]
Hi Philip
I had the same problem recently and switched with success to
http://www.columbia.edu/~em36/pdftoprinter.html
as sometimes we found adobe would leave itself open so any checks to see if it was still running couldn't be relied on.
Then using the following ShellExecute code ... you will notice my method on the form agcheckexe("pdftoprinter.exe"), I have included that code as well as this basically loops until any previous instances have finished before it launches again for the next PDF you want to queue up ...
&& PDF PRINT METHOD LPARAMETERS lcfilename lcfilename=ALLTRIM(TRANSFORM(lcfilename))
declare INTEGER ShellExecute in shell32 INTEGER handle, STRING @ oper, ; STRING @ ifile, STRING @ iparam, STRING @ ipath, INTEGER showcmd
lcfile="c:\pdfprinter\pdftoprinter.exe" lcpath=""
lcparam=["]+lcfilename+["]
DO WHILE thisform.agcheckexe("pdftoprinter.exe") ENDDO
shellexecute(0,"open",lcfile,lcparam,lcpath,1) =========================
&& AGCHECKEXE METHOD LPARAMETERS tcName, tlTerminate LOCAL loLocator, loWMI, loProcesses, loProcess, llIsRunning loLocator = CREATEOBJECT('WBEMScripting.SWBEMLocator') loWMI = loLocator.ConnectServer() loWMI.Security_.ImpersonationLevel = 3 && Impersonate
loProcesses = loWMI.ExecQuery([SELECT * FROM Win32_Process WHERE Name = '] + tcName + [']) llIsRunning = .F. IF loProcesses.Count > 0 FOR EACH loProcess in loProcesses llIsRunning = .T. IF tlTerminate loProcess.Terminate(0) ENDIF ENDFOR ENDIF RETURN llIsRunning ============================
Regards
Chris
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Philip Borkholder Sent: 01 July 2021 20:55 To: profoxtech@leafe.com Subject: Pringing PDFs via ShellExecute from VFP
Hi all,
I am currently printing VFP reports in sequence, then using ShellExecute to print PDFs via their default program (Adobe DC). I am trying to keep each print job in sequence so they come out in the tray together: Example:
WO #1 Drawings for WO #1 (PDF via ShellExecute)
WO #2 Drawings for WO #1 (PDF via ShellExecute)
etc.
What I'm running into is sometimes WO#2 prints out before WO#1's PDF prints from Adobe DC.
Does anyone have experience in using a Windows API to see if Adobe has printed the PDF before I can continue printing my next VFP form?
Thanks
Philip B Bison Tech Plus
[excessive quoting removed by server]