Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, March 26, 2018 11:30:28 AM(UTC)

Walter  
Walter

Groups: Tech Support, Administrators
Posts: 368

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

With the Document Converters, there are two ways for setting the output options (Document Writers). This comes from the way the Document Converters handles document and raster conversions. Raster conversions to documents require optical character recognition (OCR), and the document writers used by the OCR engine dictate the resulting output document. Document to document conversions do not require the use of OCR; they are converted first to scalable vector graphics (SVG) and then with the document writers outputted to a new document.

If we set up the Document Writers like this:
Code:
DocumentWriter docWriters = new DocumentWriter();
PdfDocumentOptions pdfWriteOptions = docWriters.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions;
pdfWriteOptions.PageFitType = PdfDocumentPageFitType.FitHeight;
pdfWriteOptions.ZoomPercent = 100.0;
pdfWriteOptions.FitWindow = true;
pdfWriteOptions.HideMenubar = false;
pdfWriteOptions.HideToolbar = true;
pdfWriteOptions.HideWindowUI = false;
pdfWriteOptions.Protected = true;
pdfWriteOptions.OwnerPassword = "OwnerPass123";
pdfWriteOptions.EncryptionMode = PdfDocumentEncryptionMode.RC128Bit;
pdfWriteOptions.PrintEnabled = false;
pdfWriteOptions.EditEnabled = false;
pdfWriteOptions.CopyEnabled = false;
pdfWriteOptions.AssemblyEnabled = false;
pdfWriteOptions.HighQualityPrintEnabled = false;

pdfOptions.AutoBookmarksEnabled = true;
pdfOptions.AutoBookmarks.Add(new PdfAutoBookmark() { FontFaceName = "Arial", UseStyles = true, BoldStyle = true, ItalicStyle = false, FontHeight = 19.5 });
pdfOptions.AutoBookmarks.Add(new PdfAutoBookmark() { FontFaceName = "Arial", UseStyles = true, BoldStyle = true, ItalicStyle = false, FontHeight = 11 });
pdfOptions.TotalBookmarkLevels = 2;
docWriters.SetOptions(format, pdfWriteOptions);


The following is sample code illustrating how to set the output options without OCR:
Code:
using (DocumentConverter documentConverter = new DocumentConverter())
{
   documentConverter.SetDocumentWriterInstance(docWriters);
   var myJobData = DocumentConverterJobs.CreateJobData(INPUT_FILE_NAME, OUTPUT_FILE_NAME, DocumentFormat.Pdf);
   myJobData.JobName = "My job";

   var job = documentConverter.Jobs.CreateJob(myJobData);
   documentConverter.Jobs.RunJob(job);
}


The following illustrates how to set the output options when using OCR for conversions:

Code:
RasterCodecs codecs = new RasterCodecs();
DocumentWriter docWriters = new DocumentWriter();
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
ocrEngine.Startup(codecs, docWriters, TEMP_WORKING_DIRECTORY, OCR_ENGINE_RUNTIME);

using (DocumentConverter documentConverter = new DocumentConverter())
{
   documentConverter.SetOcrEngineInstance(ocrEngine, false);
   var myJobData = DocumentConverterJobs.CreateJobData(INPUT_FILE_NAME, OUTPUT_FILE_NAME, DocumentFormat.Pdf);
   myJobData.JobName = "Test conversion job";

   var job = documentConverter.Jobs.CreateJob(myJobData);
   documentConverter.Jobs.RunJob(job);
}
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.066 seconds.