473,769 Members | 5,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to wait for completion of print-to-pdf, filecopy, kill?

Hi. I've got a program printing multiple pdf reports, and I need to
wait for completion of various associated operations- The pdf printer
prints to one file, then I need to copy that where I need it, then
delete the old file, repeat with the next report. I need to wait for
each step to complete or I get errors due to the previous thing being
open and not done yet.

Is there any elegant way to do that? My FileCopy in particular has
problems. I set up a goto error loop to catch an error due to an open
file, do an api sleep for a second or two, and try again- but it
appears to pass by the loop before it's really done somehow, and I get
a permission error anyway.

Any input or pointers to where to look is welcome, thanks a bunch.

-Ann

Nov 13 '05 #1
9 5886
You may need to add a few DoEvents commands to force the application to
complete one task before starting another. If you put them
immmediately after a statement that seems to be causing your problems
that should solve that one. Add one at at time and see if that helps
you get further in your processes.

Nov 13 '05 #2
<<The pdf printer prints to one file, then I need to copy that where I need
it, then delete the old file, repeat with the next report. >>

Put all these processes in a function and put the function in a loop where
you feed in all the parameters. Access will execute everything in a function
before moving on to succeeding code (in this case the next report).

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
<ca******@csd.n et> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hi. I've got a program printing multiple pdf reports, and I need to
wait for completion of various associated operations- The pdf printer
prints to one file, then I need to copy that where I need it, then
delete the old file, repeat with the next report. I need to wait for
each step to complete or I get errors due to the previous thing being
open and not done yet.

Is there any elegant way to do that? My FileCopy in particular has
problems. I set up a goto error loop to catch an error due to an open
file, do an api sleep for a second or two, and try again- but it
appears to pass by the loop before it's really done somehow, and I get
a permission error anyway.

Any input or pointers to where to look is welcome, thanks a bunch.

-Ann

Nov 13 '05 #3
Thanks very much for the suggestions. DoEvents didn't seem to affect
anything, my code still proceeded before the report was done with its
async printing to a pdf file.

I was intrigued with the thought that I could put the report open in a
separate function, but that didn't work for me, either. The report,
opened from a separate function in a separate library, was still
printing, my filecopy command after the function came back took it
early, and wound up with an empty pdf file after copy in the copy
destination.

I was wrong about where the fail was, it is that the report print is
not completed before a subsequent filecopy tries to get hold of it and
copy it to a new location. I'll update you with anything I find. I
may just have to introduce X seconds of wait time in between reports
and hope to guess a good value for that. This is what the DoEvents
documentation says to do.

Thanks again,
Ann

Nov 13 '05 #4
Try putting the open report and print to PDF in a function and then do the
filecopy and kill outside the function. Include all this in the loop to do
multiple reports.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
<ca******@csd.n et> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
Thanks very much for the suggestions. DoEvents didn't seem to affect
anything, my code still proceeded before the report was done with its
async printing to a pdf file.

I was intrigued with the thought that I could put the report open in a
separate function, but that didn't work for me, either. The report,
opened from a separate function in a separate library, was still
printing, my filecopy command after the function came back took it
early, and wound up with an empty pdf file after copy in the copy
destination.

I was wrong about where the fail was, it is that the report print is
not completed before a subsequent filecopy tries to get hold of it and
copy it to a new location. I'll update you with anything I find. I
may just have to introduce X seconds of wait time in between reports
and hope to guess a good value for that. This is what the DoEvents
documentation says to do.

Thanks again,
Ann

Nov 13 '05 #5
Thanks. No, no luck with putting the pdf in a separate function. I
tried putting the function in the local module instead of a separate
library, still no success.

I also tried writing a text file during the report Close event, but the
text file appears before the pdf file even begins to write.

However, I see that the pdf driver creator, pdf995, has a relevant
question in their developer faq at http://www.pdf995.com/faq_dev.html,
titled "How do I use a ProcessPDF handler to programmaticall y determine
when a pdf is complete?". This has some code examples concerning
updating a pdf995-specific ini file, with the name of an application
that pdf995 will run when it is finished printing. This seems the
proper way to do it, though it locks us in to the pdf995 printer
driver, something I hoped to avoid. It's rather over my head, but
there is example code there that I will try.

Best,
Ann

Nov 13 '05 #6
Hi. I found some further help here:
http://www.freeware995.com/misc/vbacode.txt. This code was
specifically tailored for ms access. I made a few adjustments for my
situation, e.g. I don't need to reset the ini files in between every
report, but the code is solid, worked for me on a test run of 20-30
reports on a slow machine. I'm a happy camper. The code is
unattributed, but I'm grateful to whoever wrote it.

In summary, I abandoned the approach of using FileCopy to copy the pdf
report from a single pre-configured pdf report name, and instead
configured the different report names from within my program by
updating the pdf995 ini files, and printed directly to them that way.

There's also some wait checking code in this pdfwrite example that I
have left in with reduced times. I don't know if it's needed, but I
think it might be quite important.

Best,
Ann

Nov 13 '05 #7
On 23 Feb 2005 15:46:44 -0800, ca******@csd.ne t wrote:
Hi. I found some further help here:
http://www.freeware995.com/misc/vbacode.txt. This code was
specifically tailored for ms access. I made a few adjustments for my
situation, e.g. I don't need to reset the ini files in between every
report, but the code is solid, worked for me on a test run of 20-30
reports on a slow machine. I'm a happy camper. The code is
unattributed , but I'm grateful to whoever wrote it.

In summary, I abandoned the approach of using FileCopy to copy the pdf
report from a single pre-configured pdf report name, and instead
configured the different report names from within my program by
updating the pdf995 ini files, and printed directly to them that way.

There's also some wait checking code in this pdfwrite example that I
have left in with reduced times. I don't know if it's needed, but I
think it might be quite important.

Best,
Ann

Is it necessary for PDF995 to access the internet in order to print the report?
If I buy the key, will the program no longer try to access the internet?

Chuck
....
Nov 13 '05 #8
That's right, Chuck. It works quietly without loading IExplorer after
you buy and install the key. I found it's a good idea to figure out
whether the suite key is needed before buying- I needed the $19.95
pdfedit key as well as pdf995 for my code interface. If you get the
pdfedit key, the pdf995 app is also paid for.

Ann

Nov 13 '05 #9
On 3 Mar 2005 14:30:59 -0800, ca******@csd.ne t wrote:
That's right, Chuck. It works quietly without loading IExplorer after
you buy and install the key. I found it's a good idea to figure out
whether the suite key is needed before buying- I needed the $19.95
pdfedit key as well as pdf995 for my code interface. If you get the
pdfedit key, the pdf995 app is also paid for.

Ann

Thanks for the reply. $19.95 is perfectly acceptable. I just didn't want to
buy the key only to find out that the program still wanted to access the
internet.

Chuck
....
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
14790
by: James | last post by:
Hello All, I have a stored procedure which will act like a main/controller script which will then invoke more stored procedures (~20). Basically, it looks something like below: -- start script create procedure ... print 'process started' exec sp_1
3
9875
by: Danny Masti | last post by:
Hello, I have a HIDDEN div with a "Please Wait Message". OnSubmit I show the hidden div with the "Please Wait Message". It works fine. But if I replace the "Please Wait Message" with an animated gif - the gif shows up BUT it does not animate. How do I make the gif animate? THIS WORKS (initially hidden):-
1
1650
by: Andy | last post by:
Hi folks, I have following problem: #include <map> .... std::map<long, long> myMap; myMap.
1
1661
by: kuldeepiitk | last post by:
Is there any way that i can make my application wait for some time so that page loads in that time, right now I am using following code, ================================= Public Sub waitBySecs(ByVal nNumSecs As Integer) Dim d1, d2 As DateTime d1 = DateTime.Now.AddSeconds(nNumSecs) d2 = DateTime.Now
0
964
by: Oded | last post by:
Hi, I'm working on an ASP.NET application, written in C#, using VS.NET . When working on aspx pages, HTML completion does not work (neither tag closing nor statement completion). Completion works fine for code behind files and for HTML written in ascx user control files. My definitions looks fine: Tools->Options->Test Editor->HTML/XML->HTML specific: * 'Auto pop-up HTML statement completion' is checked. * 'Auto pop-up scripting statement...
4
1484
by: jason | last post by:
i am writing some simple web forms with VB.NET as the code-behind language. the code-behind files import a C# class library namespace from a .dll which is in the references list. however, when i instantiate one of the C# classes, i get no code completion for the class members. can anyone tell me why that is? thanks in advance,
4
2904
by: Let_Me_Be | last post by:
Currently I write most of the code in Vim, mainly because I can write my code remotely using ssh, the problem is that I sometimes find myself lost in the code, and for this I need good code completion. I have tried Kdevelop and Anjuta (code completion didn't work in both of them at all). Currently trying Eclipse which works fine, but fails in advanced code completion (shows private members and doesn't understand inteligent pointers ). ...
22
11754
by: Jason Zheng | last post by:
This may be a silly question but is possible for os.wait() to lose track of child processes? I'm running Python 2.4.4 on Linux kernel 2.6.20 (i686), gcc4.1.1, and glibc-2.5. Here's what happened in my situation. I first created a few child processes with Popen, then in a while(True) loop wait on any of the child process to exit, then restart a child process: import os from subprocess import Popen
9
2334
by: Lukasz Mierzejewski | last post by:
Hi, I need help with pydev code completion... Let's assume that we have something like this: class One: def fun(self): return 1 class Two: li =
3
1596
by: Siddhant | last post by:
Hi people. I was just wondering if a tab-completion feature in python command line interface would be helpful? If yes, then how can I implement it? Thanks, Siddhant
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.