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(); }
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(); }
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 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.ConvertWordToPDF.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; // 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(); }
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(); }
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(); }