0

I am in the process of converting a VB6 program that creates two page form letters for several thousand individuals each week. These letters are legally mandated, not junk mail. The letters are printed as one document to a postscript printer driver so that they can be both sent directly to a printer and converted to a PDF for archival purposes.

I am having difficulty determining how I can go about this using c#. All of the examples I have seen for printing from c# use the PrintPageEventHandler to handle the printing, but I don't see a way to use this without having created all of the form letters before even starting the print routine. Am I missing something?

The code I am converting works like this:

Loop through all groups that have letters Loop through all members in each group who need letters Send page one of the letter to the printer Send page two of the letter to the printer

When the routine is finished there is one postscript file that has five thousand or so pages in it. That file is then sent to the printer and also converted to a PDF for archival.

Is there a non-event way of printing to a printer in c#? This is a console application if that is important.

Tony Sullivan
  • 45
  • 1
  • 9
  • You are trying to print a pdf file? See [How to print a PDF with C#](https://stackoverflow.com/q/11579624/719186) – LarsTech Jul 24 '19 at 20:56
  • No, trying to print to a postscript printer driver. – Tony Sullivan Jul 24 '19 at 21:37
  • Maybe try [How to send raw data to a printer](https://stackoverflow.com/a/6911828/719186) – LarsTech Jul 24 '19 at 22:39
  • Thanks, not trying to send raw data to the printer though. I was trying to print using the Windows print driver. I never found a way to access the printer object on a non-event basis, so I just wrote my code to operate using the existing event based model. It just makes a relatively simple process look way over complicated. – Tony Sullivan Jul 26 '19 at 20:13

0 Answers0