Esempio n. 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();
        }
Esempio n. 2
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();
        }
Esempio n. 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();
        }
Esempio n. 5
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();
        }
Esempio n. 6
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();

            // 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();
        }
Esempio n. 8
0
        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();
        }
Esempio n. 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();
        }
Esempio n. 10
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();
        }
Esempio n. 11
0
        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();
        }
Esempio n. 12
0
    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!");
    }
Esempio n. 13
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();
        }
Esempio n. 14
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();
        }
Esempio n. 15
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();
        }