[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

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

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
baco
Asked:
baco
1 Solution
 
n_narayananCommented:
which operating system you are using and what commands you are using. Can you explain in detail.

Narayanan
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
bruintjeCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RemCommented:
ping

Yep details please

tot horens

Rem
0
 
bacoAuthor Commented:
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
 
bruintjeCommented:
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
 
bacoAuthor Commented:
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
 
bacoAuthor Commented:
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
 
bruintjeCommented:
>>>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
 
bacoAuthor Commented:
YES!!!!!!!!!!!! i got it!!!

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

cool!! but ....
who earns the points??
0
 
bacoAuthor Commented:
i forgot...

like this it will save a pdf file.. then i will convert it to ps and then it's done!
0
 
bruintjeCommented:
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
 
bacoAuthor Commented:
and how will i do that?
0
 
bruintjeCommented:
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
 
bacoAuthor Commented:
:)

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
 
bruintjeCommented:
you just print to file then through the postscript printer driver, that's nice
0
 
bacoAuthor Commented:
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
 
bacoAuthor Commented:
Bruintje,

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

Bedankt!
0
 
bacoAuthor Commented:
Thanks again!
0
 
bruintjeCommented:
bedankt, je had ze ook voor een volgende vraag kunnen bewaren

thanks again
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now