←Select platform

DocumentWriterEmptyPage Class

Summary
Data for one empty page to be added to a document file.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public class DocumentWriterEmptyPage : DocumentWriterPage 
@interface LTDocumentWriterEmptyPage : LTDocumentWriterPage<NSCopying> 
public class DocumentWriterEmptyPage extends DocumentWriterPage 
public ref class DocumentWriterEmptyPage : public DocumentWriterPage  
class DocumentWriterEmptyPage(DocumentWriterPage): 
Remarks

The DocumentWriterEmptyPage class derives from DocumentWriterPage and contains the data for one empty page to be added to a document file. It is used as a parameter to the DocumentWriter.AddPage or DocumentWriter.InsertPage methods used to add the page.

The LEADTOOLS Document Writer supports creating documents with zero or more empty pages inside them. Simply add a page with type DocumentWriterEmptyPage and call the DocumentWriter.AddPage or DocumentWriter.InsertPage methods. The dimension of the empty page must be set before hand in the DocumentWriterEmptyPage.Width and DocumentWriterEmptyPage.Height and its resolution set to DocumentOptions.EmptyPageResolution. As many empty pages as desired can be added in any index desired. To use empty pages, make sure the DocumentOptions.PageRestriction property is set to DocumentPageRestriction.Relaxed.

For more information, refer to PdfDocumentOptions.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Document.Writer; 
using Leadtools.Ocr; 
 
 
public void DocumentRasterPageExample() 
{ 
   // Input file name 
   var inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "TEST.docx"); 
 
   // Output PDF file name 
   var outputFileName = Path.Combine(LEAD_VARS.ImagesDir, "out_Example.pdf"); 
 
   // Create a new instance of the LEADTOOLS Document Writer 
   var docWriter = new DocumentWriter(); 
 
   // Setup a new RasterCodecs object 
   using (var codecs = new RasterCodecs()) 
   { 
      codecs.Options.RasterizeDocument.Load.Resolution = 300; 
 
      // Get information on the page 
      double pageWidth; 
      double pageHeight; 
      using (var info = codecs.GetInformation(inputFileName, false, 1)) 
      { 
         // Get the size in inches, we need it for the empty page 
         pageWidth = info.Document.PageWidth; 
         pageHeight = info.Document.PageHeight; 
      } 
 
      // Begin the document 
      docWriter.BeginDocument(outputFileName, DocumentFormat.Pdf); 
 
      // Add the first page from SVG 
      var svgPage = new DocumentWriterSvgPage(); 
      using (svgPage.SvgDocument = codecs.LoadSvg(inputFileName, 1, null)) 
      { 
         // Add it 
         docWriter.AddPage(svgPage); 
      } 
 
      // Add a second page as empty 
      var emptyPage = new DocumentWriterEmptyPage(); 
      emptyPage.Width = pageWidth; 
      emptyPage.Height = pageHeight; 
      docWriter.AddPage(emptyPage); 
 
      // Finally, add a third page as an image 
      var rasterPage = new DocumentWriterRasterPage(); 
      using (rasterPage.Image = codecs.Load(inputFileName, 1)) 
      { 
         // Add it 
         docWriter.AddPage(rasterPage); 
      } 
   } 
 
   // Finally finish writing the HTML file on disk 
   docWriter.EndDocument(); 
} 
 
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.