←Select platform

Position Property

Summary

Target position to use after moving to the page.

Syntax
C#
C++/CLI
Java
Python
public LeadPointD Position { get; set; } 
public:  
   property LeadPointD^ Position 
   { 
      LeadPointD^ get() 
      void set(LeadPointD^ value) 
   } 
public LeadPointD getPosition() 
public void setPosition(LeadPointD value) 
Position # get and set (DocumentLinkTarget) 

Property Value

The target position to use after moving to the page in document coordinates. Default value is 0,0.

Remarks

This value is in document coordinates. Refer to Document Library Coordinate System for more information.

Viewer applications would normally perform the following when a link target is invoked:

  1. Go to the page number specified in PageNumber.

  2. Check the value of PageFitType, if it is other than DocumentPageFitType.None then fit the page as specified.

  3. If the of PageFitType is DocumentPageFitType.None then use Position to scroll to a specific position in the page and optionally ZoomPercent to update the zoom value.

Viewer application should verify these values and can chose to support only partial implementation.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Document.Writer; 
 
using Leadtools.Document; 
using Leadtools.Caching; 
using Leadtools.Annotations.Engine; 
using Leadtools.Ocr; 
using Leadtools.Barcode; 
using Leadtools.Document.Converter; 
 
public void DocumentPageGetLinksExample() 
{ 
   var cache = GetCache(); 
   var options = new LoadDocumentOptions(); 
   options.Cache = cache; 
   using (var document = DocumentFactory.LoadFromFile(Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf"), options)) 
   { 
      document.IsReadOnly = false; 
      // Show the links before parsing the URL in the text 
      Console.WriteLine("Before get text"); 
      Console.WriteLine("---------"); 
      var page = document.Pages[0]; 
      page.SetLinks(page.GetLinks()); 
      ShowLinks(page); 
 
      // Get all of the DocumentPageFitTypes 
      DocumentPageFitType[] pageFitType = (DocumentPageFitType[])Enum.GetValues(typeof(DocumentPageFitType)); 
      foreach (var type in pageFitType) 
      { 
         Console.WriteLine($"Page fit type: {type}"); 
      } 
 
      // Make sure we will parse the hyper links 
      // DocumentText reference 
      document.Text.AutoParseLinks = true; 
      document.Text.TextExtractionMode = DocumentTextExtractionMode.Auto; 
 
      // Show the regular expressions 
      Console.WriteLine("Parsing links from the text using these regular expressions:"); 
      foreach (var regex in DocumentText.LinkPatterns) 
      { 
         Console.WriteLine(regex.ToString()); 
      } 
 
      // Now, get the text to parse the links from it 
      page.GetText(); 
 
      page.IsLinksModified = false; 
 
      // Show the links before parsing the URL in the text. It should now show the original plus any parsed URLs from the text 
      Console.WriteLine("After get text"); 
      Console.WriteLine("---------"); 
      ShowLinks(page); 
   } 
} 
 
private static void ShowLinks(Leadtools.Document.DocumentPage page) 
{ 
   // DocumentLink reference 
   var links = page.GetLinks(); 
   if (links != null) 
   { 
      int index = 0; 
      Console.WriteLine("Page " + page.PageNumber); 
      foreach (var link in links) 
      { 
         Console.WriteLine(index++); 
         Console.WriteLine("  Bounds:" + link.Bounds); 
         Console.WriteLine("  LinkType:" + link.LinkType); 
         if (link.LinkType == DocumentLinkType.Value) 
         { 
            Console.WriteLine("  Value:" + link.Value); 
         } 
         else 
         { 
            // DocumentLinkTarget reference 
            Console.WriteLine("  Target.PageFitType:" + link.Target.PageFitType); 
            Console.WriteLine("  Target.PageNumber:" + link.Target.PageNumber); 
            Console.WriteLine("  Target.Position:" + link.Target.Position); 
            Console.WriteLine("  Target.ZoomPercent:" + link.Target.ZoomPercent); 
         } 
         Console.WriteLine(); 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 

DocumentStructure.

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.