Beispiel #1
0
        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();

            // 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();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        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();

            // 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();
        }
Beispiel #7
0
        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();

            // 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();
        }
Beispiel #9
0
        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();
        }
Beispiel #11
0
        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();
        }
Beispiel #12
0
 public static void WriteResult(ServerDK.Results.ServerResult Result)
 {
     Console.WriteLine($"Server Status: {Result.ServerStatus}");
     if (Result.ServerStatus != ServerDK.Results.ServerStatus.Success)
     {
         Console.WriteLine($"Result Origin: {Result.Origin.Class}.{Result.Origin.Function}");
         if (!String.IsNullOrEmpty(Result.Details))
         {
             Console.WriteLine($"Result Details: {Result.Details}");
         }
         if (Result.ResultException != null)
         {
             Console.WriteLine("Exception caught during conversion.");
             Console.WriteLine($"Excpetion Details: {Result.ResultException.Message}");
             Console.WriteLine($"Exception Stack Trace: {Result.ResultException.StackTrace}");
         }
     }
 }
Beispiel #13
0
        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();
        }
Beispiel #14
0
        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();
        }
Beispiel #15
0
        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();
        }
Beispiel #16
0
        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();
        }
Beispiel #18
0
        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();
        }
Beispiel #19
0
        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();
        }
Beispiel #20
0
        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();
        }