Roger,
We have a user that cannot preview with acrobat. The message states file does not exist. Tested on their server and it works fine. It appears that the server is not thru saving the file before acrobat attempts to open it. Of course, it is faster on the server.
Any way to delay Acrobat that you know of, or delay calling acrobat?
Thanks
Fred
Omni
Preview with Acrobat
Re: Preview with Acrobat
this may seem incredibly obvious (or perhaps I don't fully understand the issue),. but why not:
// save file
sleep(100) // (or whatever time period is needed)
//call acrobat
bruce
// save file
sleep(100) // (or whatever time period is needed)
//call acrobat
bruce
There are only 10 kinds of people - those who understand binary and those who don't 

Re: Preview with Acrobat
use FILE() to test beforeomni wrote:It appears that the server is not thru saving the file before acrobat attempts to open it.
Code: Select all
DO WHILE !lExit
IF FILE(cFileName )
oPDF:loadFile( cFileName )
EXIT
ENDIF
SLEEP(100)
ENDDO
greetings by OHR
Jimmy
Jimmy
Re: Preview with Acrobat
Hello,
Had same poblem before. I assume you create PDF using DCPRINT
Wrote a simple function to fix this.
And now the WaitForFile() Function
Regards,
Jack Duijf
Had same poblem before. I assume you create PDF using DCPRINT
Wrote a simple function to fix this.
Code: Select all
cPdfFile := "C:\Data\Documents\Pdf\Invoices_" + StrZero(nInvoice,6) + ".Pdf"
DCPRINT ON NAME SELECTIE_PRINTDEVICE SIZE nMaxLines,100 FONT FONT_NORMAL TO oPrinter TOFILE OUTFILE (cPdfFile) NOSTOP
...
DCPRINT OFF
if WaitForFile(cPdfFile)
ShellExec(cPdfFile)
else
MsgBox("Unable to create PDF file " + cPdfFile)
endif
Code: Select all
Function WaitForFile(cFileName,nWait)
LOCAL nStop := 0
LOCAL lRet := TRUE // Assume file found
Default nWait to 10 // Default 10 seconds timeout
if !File(cFileName) // File not found
nStop := Seconds() + nWait // Timout moment
if nStop >= 86400 // Over midnight (Extra timeout)
Do while !File(cFileName) .and. ; // File not found
Seconds() >= 86400 - nWait // Wait for midnight
Sleep(1) // Prevent CPU 100% load
Enddo
nStop := Seconds() + nWait // New timeout
endif
Do while !File(cFileName) // As long as file not found
if Seconds() <= nStop // Within timeout periode
Sleep(10) // Prevent CPU 100% load
else // Time-out
Exit // Exit loop
endif
Enddo
lRet := File(cFileName) // Test for file
endif
//
// lRet = TRUE : File found
// = FALSE : File not found within timout periode
//
Return lRet
Jack Duijf
Regards,
Jack Duijf
Jack Duijf
Re: Preview with Acrobat
I am actually alluding to the dc_printeroff() in _dcprc.prg for dclipx.
There is a sleep(10) under one, and no sleep for the other /else.
Not sure what "IF DC_PrintPreviewAcrobatOpt()[1] == 1" represents.
On the else there is no sleep. The acrobat is called right after the printer is off, and it appears its too fast on some servers.
They are selecting the preview with acrobat from prchoice.prg, with some modifications, but basically the same.
Thanks
Fred Henck
Omni
There is a sleep(10) under one, and no sleep for the other /else.
Not sure what "IF DC_PrintPreviewAcrobatOpt()[1] == 1" represents.
On the else there is no sleep. The acrobat is called right after the printer is off, and it appears its too fast on some servers.
They are selecting the preview with acrobat from prchoice.prg, with some modifications, but basically the same.
Thanks
Fred Henck
Omni
Re: Preview with Acrobat
Fred -
Open up the file c:\exp19\source\dclipx\_dcprc.prg.
Look for the below code:
Change the number 5 to a much larger number (maybe 30).
Rebuild DCLIPX.DLL by running BUILD19_SL1.BAT.
Open up the file c:\exp19\source\dclipx\_dcprc.prg.
Look for the below code:
Code: Select all
nSeconds := Seconds()
DO WHILE !FExists(cPDFName) .AND. Seconds() - nSeconds < 5
Sleep(50)
ENDDO
lStatus := .F.
DC_SpawnUrl(cPDFName)
Rebuild DCLIPX.DLL by running BUILD19_SL1.BAT.
The eXpress train is coming - and it has more cars.
Re: Preview with Acrobat
Gotcha. I did not see that.
Thanks
Fred
Thanks
Fred