Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically Create PostScript File Type

Status
Not open for further replies.

jkzee

IS-IT--Management
Oct 8, 2002
6
US
Background: I am producing reports out of MS Access and want to distribute them in the PDF format. I have a function that generates 38 separate reports and want to save each report in PDF format.

What I have done so far: I have Adobe Acrobat Distiller and know about the PDFDistiller.FileToPDF method to take a PST (postscript) file and convert to PDF format.

Need Help: How can I programmatically take the Access report (or any file for that matter) and create a postscript file? If I use the OpenReport function, it will prompt for a file name (where the default printer is a postscript FILE printer type). I want to be able to create the PST file without the prompting of the file name.

Any help would be appreciated.

Thanks,
Jack
 
You can use a program called redmon. Redmon writes the output of the print driver (i.e. the postscript file) to a temporary file and then passes the path of that file to a program of your choice. I have it run just a simple program that moves and renames the file. You can find redmon at


i'm pretty sure redmon is free for regular use.
 
Hello Cheyney,

Thank you so much for your help...I will check that out and let everyone know if this works.

Regards,
Jack
 
Cheyney... a little help please?

I can't fathom what goes into the arguments box.

If I leave it blank, and have Distiller as my receiving program, then Distiller fires up but ingests no file, understandably because I'm not passing one. If I hard code the name of an existing postscript file into the arguments, then Distiller distills it.

If I have a VB prog and have it print the command string in a text box it remains blank if I leave Redmon's arguments empty. If I put some garbage there, then my prog ingests that and shows it in its text box.

This all proves that Redmon is indeed passing the arguments; I just don't know what to put in so that it sends the path of the temp file.

I'll take care of parsing the name out of the command string in VB, just can't get the file name sent in the first place!

I tried %1 and "%1"... any ideas please?

Jim Brown,
Johannesburg,
South Africa.
My time is GMT+2
 
You need to use redrun as well. This is how my options go:

Redirect this port to the program:
c:\whatever\redrun.exe

Arguments for this program are:
c:\whatever2\myprogram.exe %1

Output:
Program handles output

Run:
Hidden

Run as user - yes

I believe redrun just catches the file stream on stdin, saves it to a temp file, then launches your program (it also waits until the launched program is terminated and then deletes the temp postscrip, you can prevent it from doing this by moving it, renaming it, or setting it to read-only in your program).
I think you should be able to write your own program that catches stdin and you would be able to kick out the redrun step, but the way shown above works 100% for me. I especially like the option to run as user, since it normally wouldn't if you ignorantly wrote your own print driver program (since the spooler runs in the system context, so would your driver program)

I'm sure this will work for you,

cheyney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top