←Select platform

DocumentResolution Property

Summary
Document resolution (in dots per inch) of the resulting document.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public int DocumentResolution { get; set; } 
@property (nonatomic, assign) NSInteger documentResolution; 
public int getDocumentResolution() 
public void setDocumentResolution(int resolution) 
public: 
property int DocumentResolution { 
   int get(); 
   void set (    int ); 
} 
DocumentResolution # get and set (DocumentOptions) 

Property Value

Document resolution value given in dots per inch unit and it controls the dimensions of the resulting document. Default value is 0 (use the resolution of the actual page).

Remarks

When creating documents, the DocumentWriter object will use the resolution set in the Enhanced Metafile handle passed to DocumentWriter.AddPage or DocumentWriter.InsertPage methods through DocumentWriterEmfPage.EmfHandle. However, sometimes it is desirable to override this behavior and use a pre-calculated fixed value for the resolution instead. To do this, change the value of the DocumentResolution property from the default value of 0 to the desired value before any calls to DocumentWriter.AddPage or DocumentWriter.InsertPage.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Document.Writer; 
using Leadtools.Ocr; 
 
 
public void DocumentWriterExample() 
{ 
   var inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "test.docx"); 
   var outputFileName = Path.Combine(LEAD_VARS.ImagesDir, "Example.pdf"); 
 
   // Setup a new RasterCodecs object 
   var codecs = new RasterCodecs(); 
   codecs.Options.RasterizeDocument.Load.Resolution = 300; 
 
   // Get the number of pages in the input document 
   var pageCount = codecs.GetTotalPages(inputFileName); 
 
   // Create a new instance of the LEADTOOLS Document Writer 
   var docWriter = new DocumentWriter(); 
 
   // Change the PDF options 
   var pdfOptions = docWriter.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions; 
   pdfOptions.DocumentType = PdfDocumentType.PdfA; 
   docWriter.SetOptions(DocumentFormat.Pdf, pdfOptions); 
 
   // Create a new PDF document 
   Debug.WriteLine("Creating new PDF document: {0}", outputFileName); 
   docWriter.BeginDocument(outputFileName, DocumentFormat.Pdf); 
 
   // Loop through all the pages 
   for (var pageNumber = 1; pageNumber <= pageCount; pageNumber++) 
   { 
      // Get the page as SVG 
      Debug.WriteLine("Loading page {0}", pageNumber); 
      var page = new DocumentWriterSvgPage(); 
      page.SvgDocument = codecs.LoadSvg(inputFileName, pageNumber, null); 
 
      // Add the page 
      Debug.WriteLine("Adding page {0}", pageNumber); 
      docWriter.AddPage(page); 
 
      page.SvgDocument.Dispose(); 
   } 
 
   // Finally finish writing the PDF file on disk 
   docWriter.EndDocument(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.Writer Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.