Click here to Skip to main content
15,891,864 members

Printer automation problem

Member 11683251 asked:

Open original thread
I'm trying to convert several documents to pdf via VB6. The documents are created by vb6 from a database and inserted into a report which I print using a pdf printer to a folder.

When I print a file I wish to move it and rename it to the correct filename. Got the code done to do so.

I've got a problem where the file isn't "printed" quick enough meaning I try to move a file which doesn't yet exist. I tried to sleep my program but that doesn't help, it seems the printing is done in the same thread as the program or something.

I've come up with several work arounds in my head but they all got their own problem. One was if I named the file differently then I could print one file, get the data and start printing the next one and then move back to the first one and do a move and rename. Basically trailing one print job all the time. But that is a no go atm because one problem is that I cant send an argument with what I want the filename to be. Bullzip which I use seems to take a window name as the filename, eg printing from notepad creates a file called notepad - openfile.pdf

My files gets named as MSDataReport.pdf. I'm curious if I can make this approach usable by getting the window using windows api?

The "best" results so far have been by adding a plain msgbox which pops up and then use a timed auto clicker to wait a few seconds and then press ok. It seems that the messagebox doesn't prevent the printing the same way as sleep does. This approach is risky and will lock my computer for the duration so it's not optimal either but atleast it saves me from a lot of manual labor.

Any thoughts on what I can do? Either improve my own solutions or other ways to work around this?
Tags: Visual Basic 6

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900