// Copyright (c) 2021 ActivePDF, Inc. // ActivePDF Meridian 2010 // Example generated 01/18/21 using System; // Make sure to add the ActivePDF product .NET DLL(s) to your application. // .NET DLL(s) are typically found in the products 'bin' folder. class Examples { public static void Example() { string strPath; int intWait; strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APMeridian.Meridian oMER = new APMeridian.Meridian(); // Specify the IP address and Port to use to reach the Meridian Server oMER.StartRemoteClient("192.168.1.100", 54545); // In order to know which print job belongs to which process you must // specify the process and thread ID of the printing application // being that the printing is happening within this script we can use // -1 values which means the process and thread ID's of this script oMER.SetProcessAndThread(-1, -1); // Specify the remote path to the Meridian printer // This printer must be added locally to the system that will be printing oMER.ModelPrinter = "\\\\192.168.1.100\\Meridian"; // Path and filename of the created PDF oMER.OutputDirectory = strPath; oMER.NewDocumentName = "TestPrint.pdf"; // Prepare to start the printing process oMER.StartPrinting(); // At this point send the print job to the printer, as this is a test // we call the 'Test' method to send an internal print job oMER.Test("Hello World"); // End the printing process oMER.StopPrinting(); // Wait(seconds) for job to complete intWait = oMER.Wait(30); if (intWait != 0) { ErrorHandler("Wait", intWait); } // Release Object oMER = null; // Process Complete WriteResults("Done!"); } // Error Handling public static void ErrorHandler(string strMethod, object rtnCode) { WriteResults(strMethod + " error: " + rtnCode.ToString()); } // Write output data public static void WriteResults(string content) { // Choose where to write out results // Debug output //System.Diagnostics.Debug.WriteLine("ActivePDF: * " + content); // Console Console.WriteLine(content); // Log file //using (System.IO.TextWriter writer = new System.IO.StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory + "application.log", true)) //{ // writer.WriteLine("[" + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + "]: => " + content); //} } }