|
-
March 10th, 2011, 09:28 AM
#1
Redirect Printer Output To Specific File
Hi, having nightmares with PDF again......
What I basically need to do is to set a printer in Windows to print to file and then programatically set the output file name at runtime.
In more detail.
I have set up a Postscript printer to print to a fixed file name.
In my code I set this to be the default printer.
I then print an Access report to this printer.
Once this report has printed I am using Ghostscript to convert the resulting printer file (which is in EPS format) to PDF.
This all works fine and has been for some time but I have now run into brick wall when this is used by multiple users using Remote Desktop because they are trying to write to the same printer output file.
Unfortunately this system is used on a number of different sites some of which are using Access 2000/2003 so I cannot use the new PDF options in Access/Office.
I am using the API WriteProfileString function to set the default printer.
Any help on this problem would be greatly appreciated.
Thanks
-
March 10th, 2011, 11:17 AM
#2
Re: Redirect Printer Output To Specific File
You'd have to change the name of the output file to reflect each user
-
March 10th, 2011, 11:57 AM
#3
Re: Redirect Printer Output To Specific File
Dglienna: I need to know if it is possible to change the name of the printer output file from within my VB6 project. Ideally I would use a randomly generated output file name each time as the files are only required temporarily while the PDF conversion takes place. The only possibility I can see at the moment is to set the printer to output to file and then use sendkeys to force the filename accross to the printer driver when it asks for the output filename. (Not ideal!!!)
Thanks
-
March 10th, 2011, 01:06 PM
#4
Re: Redirect Printer Output To Specific File
Well, VB.Net has a FileWatcher class that might help. You could monitor that folder, and move/rename as a separate operation.
I'd have to see the code that saves the filename.
-
March 10th, 2011, 02:05 PM
#5
Re: Redirect Printer Output To Specific File
Many printer objects do have the filename property...
I'm sure you can pass the filename to the object ...
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
March 10th, 2011, 04:10 PM
#6
Re: Redirect Printer Output To Specific File
Dglienna: Sorry but the problem with the multiuser environment is that multiple machines are trying to write to the same file at the same time so a file move operation would not be possible. I could check to see if the file exists first and then wait before trying to output the file but then if any of the machines fail to delete the file after conversion to PDF then the whole system would stall. I need to get the printer driver to output to a specified filename so that each machine can process files simultaneously.
Thanks
Last edited by Killa69; March 10th, 2011 at 07:18 PM.
-
March 10th, 2011, 04:14 PM
#7
Re: Redirect Printer Output To Specific File
GremlinSA: Could you give me some more details, I am not actually directly accessing any printer objects, it is Microsoft Access that is sending the report to the printer driver and the printer driver is then sending the output to a file.
Thanks
-
March 10th, 2011, 08:53 PM
#8
Re: Redirect Printer Output To Specific File
If you tell the printer to PRINT TO FILE in it's setup, it will prompt for a filename
-
March 10th, 2011, 10:23 PM
#9
Re: Redirect Printer Output To Specific File
I am sorry if I have failed to explain the problem clearly, but I need my program to tell the printer which file to print to, my program uses this printer output file to generate the PDF file, so having the user enter a file name for the printer output file will not really be much use.
In essence I need to set a default printer (which I can do) and output to a specific filename that my program will generate.
Configuring the printer to output to file will ask for a filename (No good).
Configuring the printer to print to a static filename (Always print to the same file) causes problems in the multiuser environment.
My program needs to generate a unique filename each time (Like windows temporary files) and then configure the printer driver to output to this file before I generate the Access report.
I hope this clarfies what I am trying to achieve.
Last edited by Killa69; March 10th, 2011 at 10:29 PM.
-
March 10th, 2011, 11:27 PM
#10
Re: Redirect Printer Output To Specific File
Time to re-think the design, I'd say...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|