←Select platform

Position Property

Summary
Position in the initial page to scroll to.
Syntax
C#
C++/CLI
Java
Python
public PDFPoint Position { get; set; } 
public PDFPoint getPosition(); 
public void setPosition( 
   PDFPoint pDFPoint 
); 
public: 
property PDFPoint Position { 
   PDFPoint get(); 
   void set (    PDFPoint ); 
} 
Position # get and set (PDFInitialViewOptions) 

Property Value

A PDFPoint that represents the position in PDF units (1/72 of an inch and bottom-left) of the initial page to scroll to. The default value is an empty PDFPoint.

Remarks

Set this property to indicate the position to scroll to when the PDF file is opened.

The position is in PDF units (1/72 of an inch and bottom-left). So to go to the top of the page, you must go to "0, PageHeight". You can use the PDFDocumentPage.ConvertPoint helper method to convert from pixel or inches to PDF units and back.

Example
C#
Java
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
 
 
public void PDFFileInitialViewOptionsExample() 
{ 
   string sourceFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
   string destinationFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_InitialView.pdf"); 
 
   PDFFile pdfFile = new PDFFile(sourceFileName); 
 
   PDFInitialViewOptions myInitialViewOptions = new PDFInitialViewOptions(); 
   myInitialViewOptions.AutoPrint = false; 
   myInitialViewOptions.CenterWindow = false; 
   myInitialViewOptions.DisplayDocTitle = true; 
   myInitialViewOptions.FitWindow = false; 
   myInitialViewOptions.HideMenubar = true; 
   myInitialViewOptions.HideToolbar = true; 
   myInitialViewOptions.HideWindowUI = true; 
   myInitialViewOptions.PageFitType = PDFPageFitType.FitWidth; 
   myInitialViewOptions.PageLayoutType = PDFPageLayoutType.OneColumnDisplay; 
   myInitialViewOptions.PageModeType = PDFPageModeType.PageOnly; 
   myInitialViewOptions.PageNumber = 2; 
   myInitialViewOptions.ZoomPercent = 100; 
 
   pdfFile.InitialViewOptions = myInitialViewOptions; 
 
   pdfFile.SetInitialView(destinationFileName); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.ByteArrayInputStream; 
import java.io.File; 
import java.io.FileInputStream; 
import java.io.FileNotFoundException; 
import java.io.FileOutputStream; 
import java.io.FileReader; 
import java.io.IOException; 
import java.io.InputStream; 
import java.nio.file.Files; 
import java.nio.file.Paths; 
import java.nio.file.StandardCopyOption; 
import java.util.ArrayList; 
import java.util.Date; 
import java.util.List; 
import java.util.Scanner; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.pdf.*; 
 
 
public void pdfFileInitialViewOptionsExample() { 
 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String sourceFileName = combine(LEAD_VARS_IMAGES_DIR, "Leadtools.pdf"); 
   String destFileName = combine(LEAD_VARS_IMAGES_DIR, "LEAD_InitialView.pdf"); 
   PDFFile pdfFile = new PDFFile(sourceFileName); 
 
   PDFInitialViewOptions myInitialViewOptions = new PDFInitialViewOptions(); 
   myInitialViewOptions.setAutoPrint(false); 
   myInitialViewOptions.setCenterWindow(false); 
   myInitialViewOptions.setDisplayDocTitle(true); 
   myInitialViewOptions.setFitWindow(false); 
   myInitialViewOptions.setMenubar(true); 
   myInitialViewOptions.setHideToolbar(true); 
   myInitialViewOptions.setHideWindowUI(true); 
   myInitialViewOptions.setPageFitType(PDFPageFitType.FIT_WIDTH); 
   myInitialViewOptions.setPageLayoutType(PDFPageLayoutType.ONE_COLUMN_DISPLAY); 
   myInitialViewOptions.setPageModeType(PDFPageModeType.PAGE_ONLY); 
   myInitialViewOptions.setPageNumber(2); 
   myInitialViewOptions.setZoomPercent(100); 
 
   pdfFile.setInitialViewOptions(myInitialViewOptions); 
   pdfFile.setInitialView(destFileName); 
 
   assertTrue("Check that the file's properties have been set", 
         pdfFile.getInitialViewOptions().getAutoPrint() == false); 
} 
Requirements

Target Platforms

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

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