C# code for event handling (handles the enddocpost event)

This is a read only forum. It contains the most frequently asked questions about Amyuni products and licensing.
Post Reply
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

C# code for event handling (handles the enddocpost event)

Post by Joan »

Below is a sample code snippet to handle, the enddocpost event. This event is fired when the document has finished printing

Code: Select all

 private void btnPrintText_Click(object sender, System.EventArgs e)

            {

                  CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfEx(); 

                  PrinterName prt = new PrinterName();

                  prt.PrintN = "Amyuni PDF Converter";

               PDF.DriverInit (prt.PrintN.ToString ());  //Amyuni PDF Converter
                PDF.DefaultFileName = txtSaveFile.Text;

                   PDF.SetDefaultPrinter();
                   

                        PDF.PaperSize = 1;            // letter
                        PDF.Orientation = 1;          // portrait
                        PDF.HorizontalMargin = 0;
                        PDF.VerticalMargin = 0;
                        PDF.Resolution = 1200;
                        PDF.ImageOptions = 1;         // no duplicates
                        PDF.SetDefaultConfigEx();


//These delegates handle messages generated by the PDF Converter

PDF.EndDocPost +=new _DCDIntfEvents_EndDocPostEventHandler(this.mySample);         

//PDF.FileNameOptionsEx = (int) sNoPrompt +  sUseFileName + 0x10 + 0x8000 + 8; //33307

                        int Foex = 0;
                        Foex += 1;             // no dialog
                        Foex += 2;            // use default filename
                        Foex += 8;            // use compression
                        Foex += 0x10;      // embed fonts
                        Foex += 0x200;    // embed full fonts
                        Foex += 0x8000;   
                        PDF.FileNameOptionsEx = Foex;

printDocument1.PrinterSettings.PrinterName = prt.PrintN.ToString();               

                        PDF.CaptureEvents (1); //enable capturing events
 
                        PDF.EnablePrinter (strLicenseTo , strActivationCode );      

                        //Print something
                        printDocument1.Print();

                         //PDF.RestoreDefaultPrinter();

                        //PDF.FileNameOptions = 0;           

            }

            private void mySample()

            {
                  MessageBox.Show ("Document has finished printing");

            }
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
Post Reply