Via the following post it should be possible to rotate images via FineReader Engine
http://forum.ocrsdk.com/thread/588-rotation-image-via-fine-reader-engine/
In one of the reactions a pointer has been given to some (what seems) .NET-code
Is there any chance of a sample in Java (for the com.abbyy.finereader jar) or Java-documentation in any kind?
At the moment we fully OCR an image but like to automatically rotate if a landscape page has been scanned in portrait mode
private final static String DLL_FOLDER = "/opt/ABBYY/FREngine11/Bin";
private final static String DEVELOPER_SN = "SWED....................";
private void ocrPdf(String inputPdfFilename, String outputPdfFilename) throws Exception {
//init FREngine/IEngine with default profile
IEngine engine = Engine.GetEngineObject(DLL_FOLDER, DEVELOPER_SN);
engine.LoadPredefinedProfile("DocumentConversion_Accuracy");
//create new document and insert PDF
IFRDocument document = engine.CreateFRDocument();
document.AddImageFile(inputPdfFilename, null, null);
//process full document
document.Process(null);
// Save results to pdf using 'balanced' scenario
IPDFExportParams pdfParams = engine.CreatePDFExportParams();
pdfParams.setScenario( PDFExportScenarioEnum.PES_Balanced );
//export PDF to disk and close handle with document
document.Export(outputPdfFilename, FileExportFormatEnum.FEF_PDF, pdfParams);
document.Close();
}
Comments
3 comments
Hi Koen de Leijer,
As far as I know you have already received the answer from our technical consultant. I will duplicate this answer here too:
Java-documentation and samples: ABBYY SDKs does not have documentation in JavaDoc format. Documentation in PDF and HTML formats can be found in the Help subfolder of SDK’s distributive.
All available samples can be found in "...\FineReader Engine\Samples" folder after installation with the default parameters.
Rotation: You need to set to TRUE setting CorrectOrientation (DocumentProcessingParams -> PageProcessingParams -> PagePreprocessingParams).
Additional settings for orientation correction are available through OrientationDetectionParams (DocumentProcessingParams -> PageProcessingParams -> PagePreprocessingParams).
Hi Lilya
Thanks !
Both the samples and menu-options were not helpful because we use the Finereader Engine directly from Java. In FREngine11UserGuide.pdf there was a sample in C++/C# that leaded me to the following Java-statements:
Full working solution
Thank you for sharing this solution!
Please sign in to leave a comment.