←Select platform

ViewPerspective Property

Summary

Current view perspective (transformation) value of this page.

Syntax
C#
C++/CLI
Python
public RasterViewPerspective ViewPerspective { get; set; } 
public:  
   property RasterViewPerspective^ ViewPerspective 
   { 
      RasterViewPerspective^ get() 
      void set(RasterViewPerspective^ value) 
   } 
ViewPerspective # get and set (DocumentPage) 

Property Value

The current view perspective of this page. The default value is RasterViewPerspective.TopLeft.

Remarks

ViewPerspective holds the current transformation of the page. Initially, it contains the value of TopLeft, which means that no transformation has been applied to this page. Transformation can be reset by setting ViewPerspective back to TopLeft.

ViewPerspective is saved into the cache entry of the page and is re-loaded and used when the document is loaded back from the cache.

Each call to Rotate, Flip and Reverse will update ViewPerspective with the value that matches the new transformation.

Refer to Document Page Transformation for more information.

Example
C#
using Leadtools.Document; 
using Leadtools.Document.Converter; 
using Leadtools.Document.Writer; 
 
 
public void DocumentPageRotateExample() 
{ 
   var documentUri = new Uri("https://demo.leadtools.com/images/pdf/leadtools.pdf"); 
   string documentFile = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf"); 
 
   // Load this document 
   var loadDocumentOptions = new LoadDocumentOptions(); 
   using (var document = DocumentFactory.LoadFromUri(documentUri, loadDocumentOptions)) 
   { 
      // Documents are read-only by default and we cannot modify them. Fix that 
      document.IsReadOnly = false; 
 
      DocumentPage page; 
 
      // This document has 5 pages 
 
      // Rotate the page by 90 degrees clockwise 
      page = document.Pages[0]; 
      page.Rotate(90); 
      // Flip the second page vertically 
      page = document.Pages[1]; 
      page.Flip(); 
      // Delete the third page 
      page = document.Pages[2]; 
      page.IsDeleted = true; 
      // Reverse the fourth page 
      page = document.Pages[3]; 
      page.Reverse(); 
 
      // Set the view perspective 
      page.ViewPerspective = Leadtools.RasterViewPerspective.TopLeft; 
 
      // we will save it as a new PDF, this file should contain 4 pages with the first rotated by 90 and the second flipped vertically 
      using (var documentConverter = new DocumentConverter()) 
      { 
         var jobData = new DocumentConverterJobData(); 
         // The loaded document is our input 
         jobData.Document = document; 
         // We want PDF as output 
         jobData.DocumentFormat = DocumentFormat.Pdf; 
         // Into this file 
         jobData.OutputDocumentFileName = documentFile; 
 
         var job = documentConverter.Jobs.CreateJob(jobData); 
         documentConverter.Jobs.RunJob(job); 
      } 
   } 
 
   // Show the result 
   Process.Start(documentFile); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

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