PDF Mosaic: How to use PDF destinations


Home       Features       Download       Tutorial       Version History       License       Source Code

 

Represents a destination in the PDF document for links, bookmarks, and other interactive PDF features. Use class PDFDestination for manage destinations in PDF file. There are some methods and properties for destinations.

Method/Property Description
SetFitXYZ Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitXYZ.
SetFitPage Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitPage.
SetFitHorizontal Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitHorizontal.
SetFitVertical Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitVertical.
SetFitRectangle Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitRectangle.
SetFitBounding Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitBounding.
SetFitBoundingHorizontal Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitBoundingHorizontal.
SetFitBoundingVertical Sets the zoom type to use when displaying the page in the view to,PDFMosaic.PDFZoomMode.FitBoundingVertical.
ToString Returns a System.String that represents the current,System.Object,Page
Gets the destination page.
Left Gets the x-coordinate of the upper-left corner of the page to be positioned at the page.
Top Gets the y-coordinate of the upper-left corner of the page to be positioned at the page.
Width Gets the width of the page area to fit into the window width.
Height Gets the height of the page area to fit into the window height.
Zoom Gets the zoom percent (magnification level) of the page to be displayed.
ZoomMode Gets the zoom type of the page to be displayed in the view.
Page Gets the destination page.

 

There is the sample for using PDF destinations with help of PDF Mosaic .NET Library.


 

/*
Description:
This sample shows how to use pdf destinations.
 
Using PDFDestination in the PDF document for links, bookmarks, and other interactive PDF features.
*/
using PDFMosaic;
using System;
 
namespace HideAction
{
    class HideAction
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();            
            document.PageMode = PDFPageMode.Outlines;
 
            PDFFont fnt = new PDFFont(PDFStandardFont.Courier, 14);
            PDFSolidBrush br = new PDFSolidBrush();
            for (int i = 0; i < 10; ++i)
            {
                PDFPage page = new PDFPage(PDFPaperFormat.A4);
                page.Canvas.DrawString("Page " + (i + 1).ToString(), fnt, br, 250, 50);
                document.Pages.Add(page);
            }
 
            PDFOutline outline = new PDFOutline("Page=2 FitBounding");
            PDFDestination dest = new PDFDestination(document.Pages[1]);
            dest.SetFitBounding();
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            outline = new PDFOutline("Page=3 FitBoundingHorizontal top=50");
            dest = new PDFDestination(document.Pages[2]);
            dest.SetFitBoundingHorizontal(50);
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            outline = new PDFOutline("Page=4 FitBoundingVertical left=250");
            dest = new PDFDestination(document.Pages[3]);
            dest.SetFitBoundingVertical(250);
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            outline = new PDFOutline("Page=5 FitHorizontal top=50");
            dest = new PDFDestination(document.Pages[4]);
            dest.SetFitHorizontal(50);
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            outline = new PDFOutline("Page=6 FitPage");
            dest = new PDFDestination(document.Pages[5]);
            dest.SetFitPage();
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            outline = new PDFOutline("Page=7 SetFitRectangle left=250 top=50 width=100 height=100");
            dest = new PDFDestination(document.Pages[6]);
            dest.SetFitRectangle(250, 50, 100, 100);
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            outline = new PDFOutline("Page=8 SetFitVertical left=250");
            dest = new PDFDestination(document.Pages[7]);
            dest.SetFitVertical(250);
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            outline = new PDFOutline("Page=9 SetFitXYZ left=250 top=50 zoom=90");
            dest = new PDFDestination(document.Pages[8]);
            dest.SetFitXYZ(250, 50, 90);
            outline.Destination = dest;
            document.Outlines.Add(outline);
 
            document.Save("TestOutlinesMode.pdf", true);
        }
    }
}

 


Home       Features       Download       Tutorial       Version History       License       Source Code