Beispiel #1
0
        /// <summary>
        /// Encrypt document at run-time
        /// The Encryption property can be used to password protect a PDF document and restrict
        /// users to viewing, modifying or evenprinting the document.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Encrypt()
        {
            CDIntfEx.CDIntfExClass PDF = new CDIntfEx.CDIntfExClass();
            PDF.DriverInit(PDFprinter);

            PDF.DefaultFileName = getSampleWorkingDirectory() + "Resulting_Docs\\encrypt.pdf";

            PDF.SetDefaultPrinter();


            /*////////////////////////////////////////////////////////////
             * 'Permission                         Permission value
             * 'Enable Printing                        - 64 + 4
             * 'Enable document modification           - 64 + 8
             * 'Enable copying text and graphics       - 64 + 16
             * 'Enable adding and changing notes       - 64 + 32
             * 'To combine multiple options, use -64 plus the values 4, 8, 16 or 32. E.g. to enable */

            //1 = 40-bit encryption
            //2 = 128-bit encryption

            PDF.Encryption    = 2;
            PDF.OwnerPassword = "******";
            PDF.UserPassword  = "******";
            PDF.Permissions   = (-64 + 4);
            PDF.SetDefaultConfig();


            PDF.FileNameOptionsEx = (int)sNoPrompt + sUseFileName;
            PDF.EnablePrinter(strLicenseTo, strActivationCode);

            //Print something
            // printDocument1.Print();

            //Reset
            PDF.Encryption = 0;
            PDF.SetDefaultConfig();

            PDF.RestoreDefaultPrinter();
            PDF.FileNameOptions = 0;
        }
Beispiel #2
0
        /// <summary>
        /// Print MsWord Docs
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrintWord(object sender, System.EventArgs e)
        {
            //Declare object
            CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfExClass();

            //Initialize Printer
            PDF.DriverInit(PDFprinter);

            //set FileName for resulting PDF document
            PDF.DefaultFileName   = getSampleWorkingDirectory() + "Resulting_Docs\\print_word.pdf";
            PDF.FileNameOptionsEx = (int)(sNoPrompt + sUseFileName);

            PDF.EnablePrinter(strLicenseTo, strActivationCode);

            //Print to Word

            PrintToMsWord(getSampleWorkingDirectory() + "Source_Docs\\batchconvert.doc");

            PDF.FileNameOptions = 0;
            PDF.DriverEnd();
        }
Beispiel #3
0
        /// <summary>
        /// The BatchConvert method converts a number of files to PDF, RTF, HTML, Excel or JPeg formats in batch mode.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void BatchConvert()
        {
            CDIntfEx.CDIntfExClass PDF = new CDIntfEx.CDIntfExClass();
            PDF.DriverInit(PDFprinter);  //Amyuni PDF Converter

            PDF.SetDefaultPrinter();
            PDF.DefaultDirectory = getSampleWorkingDirectory() + "Resulting_Docs\\";
            PDF.DefaultFileName  = getSampleWorkingDirectory() + "Resulting_Docs\\test.pdf";

            PDF.FileNameOptionsEx = (int)sNoPrompt + sUseFileName;

            PDF.EnablePrinter(strLicenseTo, strActivationCode);

            /*The Document Converter printer should be configured with the destination file name and all other
             * options before calling this function. The printer should also be set as default printer.
             * This function launches the application that is associated with a specific file and issues a print
             * command to convert the document.*/

            PDF.BatchConvert(getSampleWorkingDirectory() + "Source_Docs\\Sample.docx");
            PDF.RestoreDefaultPrinter();
            PDF.FileNameOptions = 0;
        }