static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Compresses eligible objects in the output PDF, which include
            // page objects and fonts. Streams (including content, text,
            // images, and data) are not affected. SetPDFCompression is only
            // supported in PDF versions 1.5 and above. It is enabled by
            // default.
            docConverter.SetPDFCompression(true);

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    inputPath: $"{strPath}DocConverter.Word.Input.doc",
                    outputPDF: $"{strPath}DocConverter.SetPDFCompression.pdf");

            WriteResult(result);

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Set the basic metadata in the created PDF
            docConverter.SetMetadata(
                "John Doe",
                "examples, samples, metadata",
                "Examples",
                "ActivePDF Metadata Example");

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    $"{strPath}DocConverter.Word.Input.doc",
                    $"{strPath}DocConverter.SetMetadata.Output.pdf");
            WriteResult(result);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Set the amount of time before a request will time out.
            // DocConverter also has a TimeoutSpan property that accepts a
            // TimeSpan object.
            docConverter.Timeout = 40;

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult results =
                docConverter.ConvertToPDF(
                    $"{strPath}DocConverter.Word.Input.doc",
                    $"{strPath}DocConverter.Timeout.Output.pdf");
            WriteResult(result);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Start a remote conversion by opening a connection
            // Specify the IP address of the machine with the DocConverter
            // installation If 0 is used as the port number DocConverter will
            // use the default port
            docConverter.OpenRemoteConnection("#.#.#.#", 62625);

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    $"{strPath}DocConverter.Word.Input.doc",
                    $"{strPath}DocConverter.RemoteConversion.pdf");

            // Close the remote connection when finished
            docConverter.CloseRemoteConnection();

            WriteResult(result);

            // Process Complete
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Add stamp text onto the output PDF
            docConverter.AddStampCollection(collectionName: "TXTinternal");
            docConverter.StampFont             = "Helvetica";
            docConverter.StampFontSize         = 108;
            docConverter.StampFontTransparency = 0.3f;
            docConverter.StampRotation         = 45.0f;
            docConverter.StampFillMode         = ADK.PDF.FontFillMode.FillThenStroke;
            docConverter.StampColorNET         =
                new ADK.PDF.Color()
            {
                Red   = 255,
                Green = 0,
                Blue  = 0,
                Gray  = 0
            };
            docConverter.StampStrokeColorNET =
                new ADK.PDF.Color()
            {
                Red   = 100,
                Green = 0,
                Blue  = 0,
                Gray  = 0
            };
            docConverter.AddStampText(
                x: 116.0f,
                y: 156.0f,
                stampText: "Internal Only");

            // Set whether the stamp collection(s) appears in the background or
            // foreground
            docConverter.StampBackground = 0;

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    inputPath: $"{strPath}DocConverter.Word.Input.doc",
                    outputPDF: $"{strPath}DocConverter.AddStampText.pdf");

            WriteResult(result);

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate DocConverter object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Instantiate the CAD settings object
            APDocConverter.CADConverter.CADConverter cadConverterSettings =
                new APDocConverter.CADConverter.CADConverter();

            // Options available for CAD conversions
            // Options that are 'NotSet' use the setting from the configuation
            // manager
            cadConverterSettings.ASCIIHexEncoding           = false;
            cadConverterSettings.Color                      = APDocConverter.CADConverter.ColorMode.NotSet;
            cadConverterSettings.EmbedFonts                 = APDocConverter.CADConverter.EmbedFontsOptions.NotSet;
            cadConverterSettings.ExportLayers               = APDocConverter.CADConverter.LayersOptions.NotSet;
            cadConverterSettings.ExportLayouts              = APDocConverter.CADConverter.LayoutsOptions.NotSet;
            cadConverterSettings.FlateCompression           = false;
            cadConverterSettings.HatchToBitmapDPI           = 150;
            cadConverterSettings.HiddenLineRemoval          = false;
            cadConverterSettings.Lineweight                 = APDocConverter.CADConverter.LineweightOptions.NotSet;
            cadConverterSettings.OtherHatchesSettings       = APDocConverter.CADConverter.OtherHatchOptions.NotSet;
            cadConverterSettings.PlotStyleTableName         = "";
            cadConverterSettings.SHXTextAsGeometry          = false;
            cadConverterSettings.SimpleGeometryOptimization = false;
            cadConverterSettings.SolidHatchesSettings       = APDocConverter.CADConverter.SolidHatchOptions.NotSet;
            cadConverterSettings.TrueTypeAsGeometry         = false;
            cadConverterSettings.ZoomToExtents              = true;

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    $"{strPath}DocConverter.CAD.Input.dwg",
                    $"{strPath}DocConverter.ConvertCADToPDF.Options.pdf");

            WriteResult(result);

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
 // Result Handling
 public static void WriteResult(DCDK.Results.DocConverterResult Result)
 {
     Console.WriteLine($"Result Origin: {Result.Origin.Class}.{Result.Origin.Function}");
     Console.WriteLine($"Result Status: {Result.DocConverterStatus}");
     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}");
     }
 }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Add stamp image onto the output PDF
            docConverter.AddStampCollection(collectionName: "IMGimage");
            docConverter.AddStampImage(
                ImageFile: $"{strPath}DocConverter.Input.jpg",
                x: 508.0f,
                y: 16.0f,
                Width: 32.0f,
                Height: 32.0f,
                PersistRatio: true);

            // Set whether the stamp collection(s) appears in the background or
            // foreground
            docConverter.StampBackground = 0;

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    inputPath: $"{strPath}DocConverter.Word.Input.doc",
                    outputPDF: $"{strPath}DocConverter.AddStampImage.pdf");

            WriteResult(result);

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Settings specific to other formats created with from PDF
            // conversions via Solid Documents SDK are set using the
            // FromPDFOptions object
            APDocConverter.FromPDFOptions fromPDFOptions =
                new APDocConverter.FromPDFOptions();

            // To Word options
            fromPDFOptions.ToWordHeadersAndFootersMode =
                APDocConverter.ToWordHeadersAndFootersOptions.Detect;

            // Confirm the from PDF settings for conversion via Solid Documents
            // SDK
            docConverter.SetFromPDFOptions(fromPDFOptions);

            // Convert the Word document from PDF to another format using Solid
            // Documents SDK. The second parameter determines the output file
            // format
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertFromPDF(
                    $"{strPath}DocConverter.PDF.Input.pdf",
                    APDocConverter.FromPDFFunction.ToWordDocX,
                    $"{strPath}DocConverter.ConvertPDFToWord.Output.docx");
            WriteResult(result);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // 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
            docConverter.InvisiblySignFile(
                CommonName: "localhost",
                CertificateStore: "My",
                UseLocalMachine: true,
                Location: "Mission Viejo, CA",
                Reason: "Approval",
                ContactInfo: "949-555-1212",
                SignatureType: 1);

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    inputPath: $"{strPath}DocConverter.Word.Input.doc",
                    outputPDF: $"{strPath}DocConverter.DigitallySignPDF.pdf");

            WriteResult(result);

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Settings specific to other formats created with from PDF
            // conversions via Solid Documents SDK are set using the
            // FromPDFOptions object
            APDocConverter.FromPDFOptions fromPDFOptions =
                new APDocConverter.FromPDFOptions();

            // To Image options
            fromPDFOptions.ToImagePageDPI = 300;

            // Confirm the from PDF settings for conversion via Solid Documents
            // SDK
            docConverter.SetFromPDFOptions(fromPDFOptions);

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult results =
                docConverter.ConvertFromPDF(
                    $"{strPath}DocConverter.PDF.Input.pdf",
                    APDocConverter.FromPDFFunction.ToImageJPEG,
                    $"{strPath}DocConverter.ToImageJPEG.Output.jpg");
            WriteResult(result);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            string strPath   = System.AppDomain.CurrentDomain.BaseDirectory;
            string inputFile = $"{strPath}DocConverter.Word.Input.doc";

            byte[] inputFileBytes = System.IO.File.ReadAllBytes(inputFile);

            using (System.IO.MemoryStream inputStream = new System.IO.MemoryStream(inputFileBytes, 0, inputFileBytes.Length))
            {
                System.IO.MemoryStream outputStream = new System.IO.MemoryStream();

                // Instantiate Object
                APDocConverter.DocConverter docConverter =
                    new APDocConverter.DocConverter();

                // Enable extra logging (logging should only be used while
                // troubleshooting) C:\ProgramData\activePDF\Logs\
                docConverter.Debug = true;

                // Convert the file to a PDF MemoryStream
                DCDK.Results.DocConverterResult result =
                    docConverter.ConvertToPDF(
                        inputMemoryStream: inputStream,
                        APDocConverter.ToPDFFunction.FromDOC,
                        out outputStream);

                // Save the output to a local file.
                byte[] outputFile = outputStream.ToArray();
                outputStream.Close();
                System.IO.File.WriteAllBytes($"{strPath}output.pdf", outputFile);

                WriteResult(result);
            }

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Set 40-bit encryption on PDF output
            // 40-bit encryption supported in Acrobat 3+
            // A blank user password will allow the PDF to open without a
            // password.
            // (DocConverter also supports 128-bit and AES 128/256-bit
            // encryption.)
            docConverter.SetPDFSecurity(
                "userpass",
                "ownerpass",
                true,
                true,
                true,
                true);

            // Convert the file to PDF
            // If the output parameter is not used the created PDF will use
            // the input string substituting the filename extension to 'pdf'
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertToPDF(
                    $"{strPath}DocConverter.Word.Input.doc",
                    $"{strPath}DocConverter.SetPDFSecurity.Output.pdf");
            WriteResult(result);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Instantiate Object
            APDocConverter.DocConverter docConverter =
                new APDocConverter.DocConverter();

            // Enable extra logging (logging should only be used while
            // troubleshooting) C:\ProgramData\activePDF\Logs\
            docConverter.Debug = true;

            // Convert the Word document from PDF to another format using Solid
            // Documents SDK. The second parameter determines the output file
            // format
            DCDK.Results.DocConverterResult result =
                docConverter.ConvertFromPDF(
                    $"{strPath}DocConverter.PDF.Input.pdf",
                    APDocConverter.FromPDFFunction.ToPDFA,
                    $"{strPath}DocConverter.ConvertPDFToPDFA.Output.pdf");
            WriteResult(result);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }