static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // View settings for how the PDF shows in a PDF reader server.SetViewMode(viewMode: 3, PageNbr: 1, View: "Fit"); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.SetViewMode.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Path and filename of output server.OutputDirectory = strPath; // Set the basic metadata in the created PDF server.SetMetadata( author: "John Doe", keywords: "examples, samples, metadata", subject: "Examples", title: "ActivePDF Metadata Example"); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.SetMetadata.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Setup the FTP request supplying credentials if needed server.AddFTPRequest(hostAddress: "#.#.#.#", targetDirectory: "/folder"); server.SetFTPCredentials(user: "******", password: "******"); // Set which files will upload with the FTP request // To attach a binary file use AddFTPBinaryAttachment server.FTPAttachOutput = true; server.AddFTPAttachment(Filename: $"{strPath}Server.Input.ps"); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.UploadFTP.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // ActivePDF Service runs under the 'Local System' account, as such it will only see // certificates located in HKEY_LOCAL_MACHINE. To use certificates located under // a specific user set the impersonate user options in the GUI or API server.InvisiblySignFile( CommonName: "localhost", CertificateStore: "My", UseLocalMachine: true, Location: "Mission Viejo, CA", Reason: "Approval", ContactInfo: "949-555-1212", SignatureType: 1); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.SignPDF.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Path and filename of output server.OutputDirectory = strPath; // Add bookmarks to pages in the PDF server.AddPageBookmark(Title: "Page 1", subCount: 0, PageNbr: 1, View: "Fit"); server.AddPageBookmark(Title: "Page 2", subCount: 0, PageNbr: 2, View: "Fit"); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.AddPageBookmark.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Specify the PDF version for the created PDF server.CompatibilityLevel = ADK.PDF.PDFVersion.PDF1_3; // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.CompatibilityLevel.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Enable fast web view in the created PDF server.LinearizePDF = true; // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.LinearizePDF.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Stamp Images and Text onto the output PDF server.AddStampCollection("TXTinternal"); server.StampFont = "Helvetica"; server.StampFontSize = 108; server.StampFontTransparency = 0.3f; server.StampRotation = 45.0f; server.StampFillMode = ADK.PDF.FontFillMode.FillThenStroke; server.StampColorNET = new ADK.PDF.Color() { Red = 255, Green = 0, Blue = 0, Gray = 0 }; server.StampStrokeColorNET = new ADK.PDF.Color() { Red = 100, Green = 0, Blue = 0, Gray = 0 }; server.AddStampText( x: 116.0f, y: 156.0f, stampText: "Internal Only"); // Set whether the stamp collection(s) appears in the background or // foreground server.StampBackground = 0; // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.AddStampText.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Add PDF marks to be used in the converted PDF // PDF Mark Reference: // http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdfmark_reference.pdf // Notes (Page 20 - PDF Marks Reference) server.AddPDFMark(PDFMark: "[ /SrcPg 1 /Rect [32 32 216 144] /Open false /Title (ActivePDF Comment) /Contents (Note Type Comment Example.) /Color [1 0 0] /Subtype /Text /ANN pdfmark"); // Free Text (Page 17 - PDF Marks Reference) // Used for the text in the link created below server.AddPDFMark(PDFMark: "[ /SrcPg 1 /Rect [262 26 350 46] /Contents (ActivePDF.com) /DA ([0 0 1] rg /Helv 12 Tf) /BS << /W 0 >> /Q 1 /Subtype /FreeText /ANN pdfmark"); // Links (Page - PDF Marks Reference) // Add a link around the activePDF.com text created above server.AddPDFMark(PDFMark: "[ /SrcPg 1 /Rect [262 26 350 46] /Contents (ActivePDF.com) /BS << /W 0 >> /Action << /Subtype /URI /URI (http://ActivePDF.com) >> /Subtype /Link /ANN pdfmark"); // Bookmarks (Page 26 - PDF Marks Reference) server.AddPDFMark(PDFMark: "[ /Count -5 /Title (ActivePDF Server - AddPDFMark) /Page 1 /F 2 /OUT pdfmark"); server.AddPDFMark(PDFMark: "[ /Page 1 /View [/Fit] /Title (AddPDFMark - Page 1) /C [0 0 0] /F 2 /OUT pdfmark"); server.AddPDFMark(PDFMark: "[ /Page 2 /View [/Fit] /Title (AddPDFMark - Page 2) /C [0 0 0] /F 2 /OUT pdfmark"); // Document Information (Page 28 - PDF Marks Reference) server.AddPDFMark(PDFMark: "[ /Title (PDF Marks) /Author (ActivePDF Server) /Subject (PDF Marks) /Keywords (pdfmark, server, example) /DOCINFO pdfmark"); // Document View Options (Page 29 - PDF Marks Reference) server.AddPDFMark(PDFMark: "[ /PageMode /UseOutlines /Page 1 /View [/Fit] /DOCVIEW pdfmark"); // Document Open Options server.AddPDFMark(PDFMark: "[ {Catalog} << /ViewerPreferences << /HideToolbar true /HideMenubar true >> >> /PUT pdfmark"); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.AddPDFMark.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Path and filename of output server.NewDocumentName = "Server.PowerPointPrinting.pdf"; server.OutputDirectory = strPath; // Start the print job ServerDK.Results.ServerResult result = server.BeginPrintToPDF(); if (result.ServerStatus == ServerDK.Results.ServerStatus.Success) { // Automate PowerPoint to print a document to activePDF Server // NOTE: You must add the 'Microsoft PowerPoint // <<version number>> Object Library' COM object as a reference // to your .NET application to access the PowerPoint Object. Microsoft.Office.Interop.PowerPoint._Application oPPT = new Microsoft.Office.Interop.PowerPoint.Application(); Microsoft.Office.Interop.PowerPoint.Presentation oPRES = oPPT.Presentations.Open( $"{strPath}Server.PowerPoint.Input.pptx", Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse); Microsoft.Office.Interop.PowerPoint.PrintOptions objOptions = oPRES.PrintOptions; objOptions.ActivePrinter = server.NewPrinterName; objOptions.PrintInBackground = 0; oPRES.PrintOut(1, 9999, "", 1, 0); oPRES.Saved = Microsoft.Office.Core.MsoTriState.msoTrue; oPRES.Close(); oPPT.Quit(); // Wait(seconds) for job to complete result = server.EndPrintToPDF(waitTime: 30); } // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Path and filename of output server.NewDocumentName = "Server.ExcelPrinting.pdf"; server.OutputDirectory = strPath; // Start the print job ServerDK.Results.ServerResult result = server.BeginPrintToPDF(); if (result.ServerStatus == ServerDK.Results.ServerStatus.Success) { // Automate Excel to print a document to activePDF Server // NOTE: You must add a reference to the // Microsoft.Office.Interop.Excel library found in the // reference manager under Assemblies -> Extensions Microsoft.Office.Interop.Excel._Application oXLS = new Microsoft.Office.Interop.Excel.Application(); oXLS.DisplayAlerts = false; oXLS.Visible = false; object m = System.Type.Missing; Microsoft.Office.Interop.Excel._Workbook oWB = oXLS.Workbooks.Open( $"{strPath}Server.Excel.Input.xlsx", m, true, m, m, m, true, m, m, false, false, m, false); oWB.Activate(); oWB.PrintOut(1, 999, 1, false, server.NewPrinterName, false, false); oWB.Close(0); oXLS.Quit(); // Wait(seconds) for job to complete result = server.EndPrintToPDF(waitTime: 30); } // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Path and filename of output server.NewDocumentName = "Server.WordPrinting.pdf"; server.OutputDirectory = strPath; // Start the print job ServerDK.Results.ServerResult result = server.BeginPrintToPDF(); if (result.ServerStatus == ServerDK.Results.ServerStatus.Success) { // Automate Word to print a document to Server // NOTE: You must add the 'Microsoft.Office.Interop.Word' // reference Microsoft.Office.Interop.Word._Application oWORD = new Microsoft.Office.Interop.Word.Application(); oWORD.ActivePrinter = server.NewPrinterName; oWORD.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone; oWORD.Visible = false; Microsoft.Office.Interop.Word.Document oDOC = oWORD.Documents.Open($"{strPath}Server.Word.Input.doc"); oDOC.Activate(); oWORD.PrintOut(); oWORD.Documents.Close(); oWORD.Quit(); // Wait(seconds) for job to complete result = server.EndPrintToPDF(waitTime: 30); } // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Path and filename of output server.OutputDirectory = strPath; // The below font options only work with conversions that // go through the printer or postscript file conversions // Whether to embed all fonts other than base14 fonts server.EmbedAllFonts = true; // Whether to embed Base14 fonts server.EmbedBase14Fonts = true; // Whether embedded fonts should be a subset server.SubsetFonts = true; // If TrueType fonts should be substituting for the version in the // x:\windows\fonts folder server.SubstituteTTFonts = false; // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.FontOptions.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public static void Example() { string strPath; int intPSToPDF; strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APServer.Server oSVR = new APServer.Server(); intPSToPDF = oSVR.PSToPDF(strPath + "ps.ps", strPath + "ps.pdf"); if (intPSToPDF != 0) { ErrorHandler("PSToPDF", intPSToPDF); } // Release Object oSVR = null; // Process Complete WriteResults("Done!"); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertImageToPDF( ImageFile: $"{strPath}Server.ImageInput.jpg", PDF: $"{strPath}Server.ImageToPDF.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Path and filename of output server.NewDocumentName = "Server.PrintToPDF.pdf"; server.OutputDirectory = strPath; // Start the print job ServerDK.Results.ServerResult result = server.BeginPrintToPDF(); if (result.ServerStatus == ServerDK.Results.ServerStatus.Success) { // Here is where you can print to ActivePDF Server to create a // PDF from any print job, set your application to print to a //static activePDF Server printer or call server.NewPrinterName // to dynamically create a new printer on the fly. This example // simply calls server.TestPrintToPDF for testing purposes result = server.TestPrintToPDF(sampleText: "Hello World!"); if (result.ServerStatus == ServerDK.Results.ServerStatus.Success) { // Wait(seconds) for job to complete result = server.EndPrintToPDF(waitTime: 30); } } // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Create a stamp collection for the image stamp server.AddStampCollection(collectionName: "IMGimage"); // Add an image stamp to the lower right corner of each page. server.AddStampImage( ImageFile: $"{strPath}Server.ImageInput.jpg", x: 508.0f, y: 50.0f, Width: 64.0f, Height: 64.0f, PersistRatio: true); // Set whether the stamp collection(s) appears in the background or // foreground server.StampBackground = 0; // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.AddStampImage.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public static void Example() { string strPath; ServerDK.Results.ServerResult results; strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APServer.Server oSVR = new APServer.Server(); results = oSVR.ConvertPSToPDF(strPath + "ps.ps", strPath + "ps.pdf"); if (results.ServerStatus != ServerDK.Results.ServerStatus.Success) { ErrorHandler("ConvertPSToPDF", results, results.ServerStatus.ToString()); } // Release Object oSVR = null; // Process Complete WriteResults("Done!"); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Add bookmarks to pages in the PDF server.AddPageBookmark( Title: "Parent", subCount: 1, PageNbr: 1, View: "Fit"); server.AddPageBookmark( Title: "Child 1", subCount: 0, PageNbr: 2, View: "Fit"); // Add bookmarks to URLs server.AddURLBookmark( Title: "Parent URL Bookmark", subCount: 1, URL: "http://www.activepdf.com"); server.AddURLBookmark( Title: "Child URL Bookmark", subCount: 0, URL: "https://www.activepdf.com/products/server"); // Add bookmarks pointing to pages in external PDF // Both Local and UNC file paths are accepted server.AddLinkedPDFBookmark( Title: "Parent PDF Bookmark", subCount: 1, PDFFilename: $"{strPath}Server.Sample.pdf", PageNbr: 1, View: "Fit"); server.AddLinkedPDFBookmark( Title: "Child PDF Bookmark", subCount: 0, PDFFilename: $"{strPath}Server.Sample.pdf", PageNbr: 2, View: "Fit"); // Add bookmarks pointing to any external file // Both Local and UNC file paths are accepted server.AddFileBookmark( Title: "Parent File Bookmark", subCount: 1, Filename: $"{strPath}Server.PowerPoint.Input.pptx"); server.AddFileBookmark( Title: "Child File Bookmark", subCount: 0, Filename: $"{strPath}Server.Word.Input.doc"); // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.AddBookmarks.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // Add an email server.AddEMail(); // Set server information // UPDATE THIS LINE WITH YOUR SERRVER INFORMATION server.SetSMTPInfo(server: "#.#.#.#", port: 0); server.SetSMTPCredentials( user: "******", domain: "activePDF", password: "******"); // Set email addresses server.SetSenderInfo( friendlyName: "John Doe", address: "*****@*****.**"); server.SetReplyToInfo( friendlyName: "John Doe", address: "*****@*****.**"); server.SetRecipientInfo( friendlyName: "Jane Doe", address: "*****@*****.**"); server.AddToCC( friendlyName: "Jim Doe", address: "*****@*****.**"); server.AddToBcc( friendlyName: "Janice Doe", address: "*****@*****.**"); // Subject and Body server.EMailSubject = "PDF Delivery from activePDF"; server.SetEMailBody(bodyText: "<html><body style='background-color: #EEE; padding: 4px;'>Here is your PDF!</body></html>", isHtml: true); // Attachments - Binary attachments can be added with // AddEMailBinaryAttachment server.AddEMailAttachment($"{strPath}Server.Input.ps"); // Other email options server.EMailReadReceipt = false; server.EMailAttachOutput = true; // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.SendEmail.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { string strPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/"); // Instantiate Object APServer.Server server = new APServer.Server(); // The below font options only work with conversions that go // through the printer or postscript file conversions. Set the // quality options for the created PDF For custom settings to take // effect set the configuration to custom server.PredefinedSetting = ADK.PostScript.PredefinedConfiguration.Custom; // Specifies if ASCII85 encoding should be applied to binary streams server.ASCIIEncode = true; // Automatically control the page orientation based on text flow server.AutoRotate = true; // Color Image Quality Settings server.ColorImageDownsampleThreshold = 1; server.ColorImageDownsampleType = ADK.PostScript.Images.DownsampleOption.None; server.ColorImageFilter = ADK.PostScript.Images.CompressionOption.FlateEncode; server.ColorImageResolution = 72; // Specifies if CMYK colors should be converted to RGB server.ConvertCMYKToRGB = true; // Gray Image Quality Settings server.GrayImageDownsampleThreshold = 1; server.GrayImageDownsampleType = ADK.PostScript.Images.DownsampleOption.None; server.GrayImageFilter = ADK.PostScript.Images.CompressionOption.FlateEncode; server.GrayImageResolution = 72; // Monochrome Image Quality Settings server.MonoImageDownsampleThreshold = 1; server.MonoImageDownsampleType = ADK.PostScript.Images.DownsampleOption.None; server.MonoImageFilter = ADK.PostScript.Images.MonochromeCompression.FlateEncode; server.MonoImageResolution = 72; // Set whether existing halftone settings should be preserved server.PreserveHalftone = ADK.PostScript.PreserveSettingOption.Preserve; // Set whether existing overprint settings should be preserved server.PreserveOverprint = ADK.PostScript.PreserveSettingOption.Preserve; // Set how transfer functions from the input file are handled server.PreserveTransferFunction = ADK.PostScript.PreserveTransferSettings.Preserve; // Set the DPI for the created PDF server.Resolution = 300.0f; // Set whether the UCRandBGInfo, from the input file, should be // preserved server.UCRandBGInfo = ADK.PostScript.PreserveSettingOption.Preserve; // Convert the PostScript file into PDF ServerDK.Results.ServerResult result = server.ConvertPSToPDF( PSFile: $"{strPath}Server.Input.ps", PDF: $"{strPath}Server.OutputQuality.pdf"); // Output result WriteResult(result); // Process Complete Console.WriteLine("Done!"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public static void Example() { string strPath; string asdf; int intOpenOutputFile; int intOpenInputFile; bool isDebug; string strTitle; float textWidth; int testVar; int intCopyForm; long longStartPrinting; int some_var; int intLinearizeFile; string grade; int count; int currentPage; strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APToolkitNET.Toolkit oTK = new APToolkitNET.Toolkit(); asdf = "asdf" + "1234" + strPath + "asdf.pdf"; oTK.AddEmail(); oTK.AddEmail(); // Create the new PDF file intOpenOutputFile = oTK.OpenOutputFile(strPath + "new.pdf"); if (intOpenOutputFile != 0) { ErrorHandler("OpenOutputFile", intOpenOutputFile); } // Open the template PDF intOpenInputFile = oTK.OpenInputFile(strPath + "PDF.pdf"); if (intOpenInputFile != 0) { ErrorHandler("OpenInputFile", intOpenInputFile); } // Add a 'Confidential' watermark by setting text transparency // Rotation and color of the text along with the fill mode are set oTK.SetHeaderFont("Helvetica", 90); oTK.SetHeaderTextTransparency(0.6f, 0.6f); oTK.SetHeaderRotation(45); oTK.SetHeaderTextStrokeColor(255, 0, 0, 0); oTK.SetHeaderTextFillMode(1); oTK.SetHeaderText(154, 184, "Confidential"); oTK.ResetHeaderTextTransparency(); oTK.SetHeaderTextFillMode(0); oTK.MyProperty = 1; oTK.Debug = "jkl;"; isDebug = oTK.Debug; // Add a 'Top Secret' watermark by placing text in the background oTK.SetHeaderFont("Helvetica", 72); oTK.SetHeaderTextBackground(0); oTK.SetHeaderTextColor(200, 200, 200, 0); oTK.SetHeaderText(154, 300, "Top Secret"); oTK.SetHeaderTextBackground(1); oTK.ResetHeaderTextColor(); oTK.SetHeaderRotation(0); // Add the document title to the bottom center of the page oTK.SetHeaderFont("Helvetica", 12); strTitle = "Lorem Ipsum"; textWidth = oTK.GetHeaderTextWidth(strTitle); oTK.SetHeaderText((612 - textWidth) / 2, 32, strTitle); // Add page numbers to the bottom left of the page oTK.SetHeaderFont("Helvetica", 12); oTK.SetHeaderWPgNbr(72, 32, "Page %p", 1); // Add a mulitline print box for an 'approved' message in header oTK.SetHeaderTextFillMode(2); oTK.SetHeaderTextColorCMYK(0, 0, 0, 20); oTK.SetHeaderTextStrokeColorCMYK(0, 0, 0, 80); oTK.SetHeaderMultilineText("Helvetica", 22, 344, 766, 190, 86, "Approved on January 17th, 2021", 2); // Add some lines to the footer and top right corner of the page oTK.SetHeaderGreyBar(72, 52, 468, 1, 0.8f); oTK.SetHeaderHLine(340, 544, 724, 1); oTK.SetHeaderVLine(724, 648, 544, 1); testVar = oTK.GetUniqueID + ".pdf"; // Use the Header Image properties to add some images to the footer // Net comment oTK.SetHeaderImage(strPath + "BMP.bmp", 375.0f, 13.0f, 0.0f, 0.0f, true); oTK.SetHeaderJPEG(strPath + "JPEG.jpg", 436.0f, 9.0f, 0.0f, 0.0f, true); oTK.SetHeaderTIFF(strPath + "TIFF.tif", 500.0f, 15.0f, 0.0f, 0.0f, true); // Copy the template (with the stamping changes) to the new file // Start page and end page, 0 = all pages intCopyForm = oTK.CopyForm(0, 0); if (intCopyForm != 1) { ErrorHandler("CopyForm", intCopyForm); } longStartPrinting = oTK.StartPrinting(strPath + "PDF.pdf"); if (longStartPrinting != 0) { ErrorHandler("StartPrinting", longStartPrinting); } longStartPrinting = oTK.StartPrinting("file.ps", "file.pdf"); if (longStartPrinting > 1) { ErrorHandler("StartPrinting", longStartPrinting); } longStartPrinting = oTK.StartPrinting("file.ps", "file.pdf"); if (longStartPrinting < 1) { ErrorHandler("StartPrinting", longStartPrinting); } if (some_var == 0) { intLinearizeFile = oTK.LinearizeFile(strPath + "PDF.pdf", strPath + "new.pdf", ""); if (intLinearizeFile > 0) { ErrorHandler("LinearizeFile", intLinearizeFile); } } if (some_var > 0) { intLinearizeFile = oTK.LinearizeFile(strPath + "PDF.pdf", strPath + "new.pdf", ""); if (intLinearizeFile > 0) { ErrorHandler("LinearizeFile", intLinearizeFile); } } if (some_var < 0) { oTK.conmment("This is true statement"); } else { // This is an else ErrorHandler("asdf", 234); } // Close the new file to complete PDF creation // Snippet with variables // Snippet comment from variable! oTK.SetSnippetPropertyToInt = 1; oTK.ArrayProperty = "Array of numbers and strings"; oTK.ArrayProperty = 1; oTK.ArrayProperty = 18.38f; // nil // Instantiate Object APServer.Server oSVR = new APServer.Server(); oTK.CloseOutputFile(); oSVR.CloseOutputFile(); oSVR.CloseOutputFile(); // Release Object oSVR = null; // Server cs line 2
public static void Example() { int intDoPrint; string strPath; int intOpenInputFile; string strFieldInfo; strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object NameSpace.Class objVAR = new NameSpace.Class(); // Release Object objVAR = null; // Instantiate Object APDocConv.APDocConverter oDC = new APDocConv.APDocConverter(); // Release Object oDC = null; // Instantiate Object activePDF.API.DocConverterWBE.DocConverter oDCw = new activePDF.API.DocConverterWBE.DocConverter(); // Release Object oDCw = null; // Instantiate Object APMeridian.Meridian oMER = new APMeridian.Meridian(); // Release Object oMER = null; // Instantiate Object APServer.Server oSVR = new APServer.Server(); // Release Object oSVR = null; // Instantiate Object APToolkitNET.Toolkit oTK = new APToolkitNET.Toolkit(); // Release Object oTK = null; // Instantiate Object APWebGrbNET.APWebGrabber oWG = new APWebGrbNET.APWebGrabber(); // Release Object oWG = null; // Instantiate Object APXtractor.Xtractor oXT = new APXtractor.Xtractor(); // Release Object oXT = null;