public static void Example() { string strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APOCR.Net45.OCR ocr = new APOCR.Net45.OCR(); // Enable extra logging (logging should only be used while // troubleshooting) C:\ProgramData\activePDF\Logs\ ocr.Settings.Debug = true; // Keep the recognized data after the conversion ocr.Settings.KeepRecognizedText = true; // Convert the file to PDF OCRDK.Results.OCRResult result = ocr.Convert( inputFile: $"{strPath}..\\..\\..\\Input\\OCR.TIF.Input.tif", outputFile: $"{strPath}..\\..\\..\\Output\\OCR.KeepRecText.Output.pdf"); if (result.OCRStatus == OCRDK.Results.OCRStatus.Success) { System.IO.File.WriteAllText( $"{strPath}RecognizedText.txt", ocr.RecognizedInformation.DocumentText); } WriteResult.Write(result); }
public static void Example() { string strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APOCR.Net45.OCR ocr = new APOCR.Net45.OCR(); // Enable extra logging (logging should only be used while // troubleshooting) C:\ProgramData\activePDF\Logs\ ocr.Settings.Debug = true; // PDF Security ocr.Settings.PDF.Security.UseSecurity = false; ocr.Settings.PDF.Security.Encryption = OCRData.Enums.PDF.EncryptionType.AES_256; ocr.Settings.PDF.Security.OwnerPassword = "******"; ocr.Settings.PDF.Security.UserPassword = "******"; ocr.Settings.PDF.Security.CanAnnotate = false; ocr.Settings.PDF.Security.CanAssemble = false; ocr.Settings.PDF.Security.CanCopy = false; ocr.Settings.PDF.Security.CanEdit = false; ocr.Settings.PDF.Security.CanFillInFormFields = false; ocr.Settings.PDF.Security.CanMakeAccessible = false; ocr.Settings.PDF.Security.CanPrint = false; ocr.Settings.PDF.Security.CanPrintHiResolution = false; // Convert the file to PDF OCRDK.Results.OCRResult result = ocr.Convert( inputFile: $"{strPath}..\\..\\..\\Input\\OCR.TIF.Input.tif", outputFile: $"{strPath}..\\..\\..\\Output\\OCR.SetPDFSecurity.Output.pdf"); WriteResult.Write(result); }
public static void Example() { string strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APOCR.Net45.OCR ocr = new APOCR.Net45.OCR(); // Enable extra logging (logging should only be used while // troubleshooting) C:\ProgramData\activePDF\Logs\ ocr.Settings.Debug = true; // Convert the file to PDF OCRDK.Results.OCRConversionResult result = ocr.Convert( inputFile: $"{strPath}..\\..\\..\\Input\\OCR.TIF.Input.tif", outputFile: $"{strPath}..\\..\\..\\Output\\OCR.OverwriteMethod.Output.pdf"); Console.WriteLine("First conversion complete - OverwriteMethod.Always"); WriteResult.Write(result); // Set the OverwriteMethod value to generate a new file name if the // output file exists. ocr.Settings.PDF.OverwriteMethod = OCRData.Enums.PDF.OverwriteMethod.AlterFilename; // Convert the file to PDF, this will alter the output file name result = ocr.Convert( inputFile: $"{strPath}..\\..\\..\\Input\\OCR.TIF.Input.tif", outputFile: $"{strPath}..\\..\\..\\Output\\OCR.OverwriteMethod.Output.pdf"); Console.WriteLine("Second conversion complete - OverwriteMethod.AlterFilename"); WriteResult.Write(result); // Set the OverwriteMethod value to generate a new file name if the // output file exists. ocr.Settings.PDF.OverwriteMethod = OCRData.Enums.PDF.OverwriteMethod.Never; // Convert the file to PDF, this will alter the output file name result = ocr.Convert( inputFile: $"{strPath}..\\..\\..\\Input\\OCR.TIF.Input.tif", outputFile: $"{strPath}..\\..\\..\\Output\\OCR.OverwriteMethod.Output.pdf"); Console.WriteLine("Third conversion complete - OverwriteMethod.Never"); Console.WriteLine("This conversion should result in an error, the original file already exists."); WriteResult.Write(result); }
public static void Example() { string strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APOCR.Net45.OCR ocr = new APOCR.Net45.OCR(); // Enable extra logging (logging should only be used while // troubleshooting) C:\ProgramData\activePDF\Logs\ ocr.Settings.Debug = true; // Time to wait for conversion to complete (in seconds) ocr.Settings.Timeout = 20; // Convert the file to PDF OCRDK.Results.OCRResult result = ocr.Convert( inputFile: $"{strPath}..\\..\\..\\Input\\OCR.TIF.Input.tif", outputFile: $"{strPath}..\\..\\..\\Output\\OCR.Timeout.Output.pdf"); WriteResult.Write(result); }
public static void Example() { string strPath = System.AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APOCR.Net45.OCR ocr = new APOCR.Net45.OCR(); // Enable extra logging (logging should only be used while // troubleshooting) C:\ProgramData\activePDF\Logs\ ocr.Settings.Debug = true; // PDF Metadata ocr.Settings.PDF.Metadata.Author = "John Doe"; ocr.Settings.PDF.Metadata.Title = "OCR Example"; ocr.Settings.PDF.Metadata.Subject = "Example"; ocr.Settings.PDF.Metadata.Keywords = "OCR, example, metadata"; // Convert the file to PDF OCRDK.Results.OCRResult result = ocr.Convert( inputFile: $"{strPath}..\\..\\..\\Input\\OCR.TIF.Input.tif", outputFile: $"{strPath}..\\..\\..\\Output\\OCR.SetMetadata.Output.pdf"); WriteResult.Write(result); }