Applies transformation on the specified pages.
public void SetViewPerspective(
RasterViewPerspective viewPerspective,
int firstPageNumber,
int lastPageNumber
)
public:
void SetViewPerspective(
RasterViewPerspective^ viewPerspective,
Int32 firstPageNumber,
Int32 lastPageNumber
)
def SetViewPerspective(self,viewPerspective,firstPageNumber,lastPageNumber):
viewPerspective
View perspective value to apply.
1-based first page number in the document. This value must be greater than or equal to 1.
lastPageNumber
1-based last page number in the document. This value must be greater or equal to
This method loops through all the pages specified and sets the value of DocumentPage.ViewPerspective to viewPerspective. For more information, refer to Document Page Transformation.
using Leadtools;
using Leadtools.Document;
using Leadtools.Document.Converter;
using Leadtools.Document.Writer;
public void DocumentPagesSetViewPerspectiveExample()
{
var documentUri = new Uri("https://demo.leadtools.com/images/pdf/leadtools.pdf");
string documentFile = Path.Combine(LEAD_VARS.ImagesDir, "PagesModified.pdf");
// Load this document
var loadDocumentOptions = new LoadDocumentOptions();
using (var document = DocumentFactory.LoadFromUri(documentUri, loadDocumentOptions))
{
using (var documentConverter = new DocumentConverter())
{
// Documents are read-only by default and we cannot modify them. Fix that
document.IsReadOnly = false;
// This document has 5 pages
DocumentPages pages = document.Pages;
// SetViewPerspective on all of the pages
pages.SetViewPerspective(RasterViewPerspective.BottomLeft270, 1, 5);
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:\LEADTOOLS23\Resources\Images";
}
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import leadtools.*;
import leadtools.document.*;
import leadtools.document.converter.*;
import leadtools.document.writer.*;
public void documentPagesSetViewPerspectiveExample() throws URISyntaxException {
Platform.loadLibrary(LTLibrary.DOCUMENT_WRITER);
String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
URI documentUri = new URI("https://demo.leadtools.com/images/pdf/leadtools.pdf");
String documentFile = combine(LEAD_VARS_IMAGES_DIR, "PagesModified.pdf");
int availableProcessors = Runtime.getRuntime().availableProcessors();
ExecutorService pool = Executors.newFixedThreadPool(availableProcessors);
RasterDefaults.setExecutorService(pool);
// Load this document
LoadDocumentOptions loadDocumentOptions = new LoadDocumentOptions();
LEADDocument document = DocumentFactory.loadFromUri(documentUri, loadDocumentOptions);
DocumentConverter documentConverter = new DocumentConverter();
// Documents are read-only by default and we cannot modify them. Fix that
document.setReadOnly(false);
// This document has 5 pages
DocumentPages pages = document.getPages();
// SetViewPerspective on all of the pages
pages.setViewPerspective(RasterViewPerspective.BOTTOM_LEFT_270, 1, 5);
// Set the job data
DocumentConverterJobData jobData = new DocumentConverterJobData();
// The loaded document is our input
jobData.setDocument(document);
// We want PDF as output
jobData.setDocumentFormat(DocumentFormat.PDF);
// Into this file
jobData.setOutputDocumentFileName(documentFile);
DocumentConverterJob job = documentConverter.getJobs().createJob(jobData);
documentConverter.getJobs().runJob(job);
// Run the job to save the file
documentConverter.getJobs().runJob(job);
if (job.getErrors().isEmpty()) {
System.out.println("Converted successfully to " + documentFile);
} else {
for (DocumentConverterJobError e : job.getErrors()) {
System.out.println(e.getError());
}
}
assertTrue(job.getErrors().isEmpty());
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document