Solved

Printing to a file and set the filename automatic...

Posted on 2002-04-24
20
229 Views
Last Modified: 2008-02-01
Hello experts,

I have a problem,

I have a apllication and it makes 250 different printjobs
i have to print them one at a time i don't want to change this (cannot change for several reasons..)

but when i print the jobs to the printer driver that makes a .ps file of it... i have to fill in the filename 250 times!!
so i want to print to a .ps file thru the printer driver but i want it to generate the filenames itself so i don't have to do it....

Please HELP me... !

Thanks in advance

greetings,

Floris van Haaster
The Netherlands
0
Comment
Question by:baco
20 Comments
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6965148
which operating system you are using and what commands you are using. Can you explain in detail.

Narayanan
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6965160
If you are using Word application to start the printing, then you can use one of the print method parameters.

If it's some other dll or 3rd party, you will shurely have some option that will solve it, we might be able to help when you identify how you are printing...

CHeers
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6965165
Hi Floris,

....don't know what you're using here but is there no batch processing in the printing process?

i use ghostscript to generate PS charts and in the batch settings it will use the filename of the file to process as the filename of the output file

As Narayanan asked a bit more detail should help are you using VB to send this to the printer or something?

:O)Bruintje
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 3

Expert Comment

by:Rem
ID: 6965175
ping

Yep details please

tot horens

Rem
0
 

Author Comment

by:baco
ID: 6965226
I use the Adobe Acrobat reference and i close a batch like this:

Private Sub EndBatch()
    AcroDoc.PrintPages 0, PdDoc.GetNumPages, 2, False, False
    Total_Pages = Total_Pages + PdDoc.GetNumPages
    PdDoc.ClearFlags (PDDocNeedsSave)
    AcroDoc.Close (False)
End Sub

so acrodoc.printpages prints the batch to the printerdriver but i can't give it a filename....
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6965380
well i steal a bit of code once written by Karl De Abrew from www.roundtable.com.au


Option Explicit ' Force variable declaration
' Author : Karl De Abrew
' Company : Round Table Solutions
' Date : 08 March 1998
' Description: PrintAllAcrobatDocsInDir
' This vb method uses IAC to print all documents in a
' directory.
' This method / function should be extended to suit the requirements
' of an organisation

Public Const POSTSCRIPT_LEVEL = 2
Public Const PDF_WILDCARD = "*.pdf"
Public Const PDF_DIRECTORY = "c:\acrobatdocstoprint\"

Sub PrintAllAcrobatDocsInDir()
Dim AcroExchAVDoc As Object, AcroExchPDDoc As Object, _
AcroExchApp As Object
Dim strFileName As String, strPath As String
Dim iNumberOfPages As Integer

Set AcroExchApp = CreateObject("AcroExch.App")
Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
Set AcroExchPDDoc = CreateObject("AcroExch.PDDoc")

' Show the Acrobat Exchange window
AcroExchApp.Show
' Set the directory / folder to use
strPath = PDF_DIRECTORY
' Get the first pdf file in the directory
strFileName = Dir(strPath + PDF_WILDCARD, vbNormal)
' Start the loop.
Do While strFileName <> ""

' Open the [strFileName] pdf file
AcroExchAVDoc.Open strPath + strFileName, ""
' Get the PDDoc associated with the open AVDoc
Set AcroExchPDDoc = AcroExchAVDoc.GetPDDoc
' Get the number of pages for this pdf [and subtract one as zero based]
iNumberOfPages = AcroExchPDDoc.GetNumPages - 1
' Print all pages in this document
AcroExchAVDoc.PrintPages 0, iNumberOfPages, POSTSCRIPT_LEVEL, True, False
' Close this file
AcroExchAVDoc.Close True
' Get the name of the next file in the directory
strFileName = Dir
Loop

' Close Acrobat Exchange
AcroExchApp.Exit
End Sub


And i guess you can apply certain elements, to open the files ready to PS through adobe you can loop the function through the directory where these files are instead of filling the name by hand

HTH:O)Bruintje
0
 

Author Comment

by:baco
ID: 6965496
No i can't use this because when i use this app i still have to fill in a filename when i print to file....

sorry thanks anyway!

...

..

.....
still no solution....
...
...
.
.
.....
....

...
0
 

Author Comment

by:baco
ID: 6965514
No i can't use this because when i use this app i still have to fill in a filename when i print to file....

sorry thanks anyway!

...

..

.....
still no solution....
...
...
.
.
.....
....

...
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6965542
>>>so acrodoc.printpages prints the batch to the printerdriver but i can't give it a filename

so the Acrobat object just comes up with the box? out of your control? which Acrobat object is this do you have to set it somewhere in your code like

set acrodoc = new "something here"
or
set acrodoc = createobject("something here")

can you get the referenced dll you use?

i just wonder if there is no property for the filename in adecent objectmodel

:O)Bruintje
0
 

Author Comment

by:baco
ID: 6965632
YES!!!!!!!!!!!! i got it!!!

    PdDoc.Save 1, "c:\batch" & batch_number & ".pdf"

cool!! but ....
who earns the points??
0
 

Author Comment

by:baco
ID: 6965637
i forgot...

like this it will save a pdf file.. then i will convert it to ps and then it's done!
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6965700
hmmmm.......seems to me you solved it yourself so ask a 0-point Q in CS and make this a PAQ because there is value in it

:O)Bruintje
0
 

Author Comment

by:baco
ID: 6965710
and how will i do that?
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6965756
OK,

Go here
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

ask a new Q
-Ask a moderator to refund your points for this Q
-Ask them to make this a PAQ

:O)Bruintje
0
 

Author Comment

by:baco
ID: 6988356
:)

I found out that you can allso add a new printer in windows
and make a new port for the printer so don't send it to lpt1 or something like that.. but something like :

c:\postscript.ps

this really works!
0
 
LVL 44

Accepted Solution

by:
bruintje earned 500 total points
ID: 6991754
you just print to file then through the postscript printer driver, that's nice
0
 

Author Comment

by:baco
ID: 6992090
Yes then I check if the file is in use...if it's not (then the printing to file is done)
then i can move it to another location with the new filename i want and continue with the next print job :)

Greetings,

Floris
0
 

Author Comment

by:baco
ID: 6992093
Bruintje,

ik paas mijn punten wel door aan jou je hebt goed geprobeert mij te helpen in ieder geval :)

Bedankt!
0
 

Author Comment

by:baco
ID: 6992095
Thanks again!
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6992916
bedankt, je had ze ook voor een volgende vraag kunnen bewaren

thanks again
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question