Page 317 - Open Soource Technologies 304.indd
P. 317

Unit 12: Portable Document Format



                                                                                                  Notes
                                       Figure 12.14: Thumbnails
































            12.5.2 Links

            pdflib supports functions that specify a region on a page that, when clicked on, takes the reader
            somewhere else. The destination can be either another part of the same document, another PDF
            document, some other application, or a web site.

            The pdf_add_locallink( ) function adds a local link to another place within the current PDF file:
            pdf_add_locallink(pdf, llx, lly, urx, ury, page, zoom);
            All links in PDF files are rectangular. The lower-left coordinate is (urx,ury) and the upper-right
            coordinate is (urx,ury). Valid zoom values are “retain”, “fitpage”, “fitwidth”, “fitheight”, and
            “fitbbox”.
            The following call defines a 50 x 50 area that, if clicked, takes the reader to page 3 and retains
            the current zoom level:
            pdf_add_locallink($p, 50, 700, 100, 750, 3, “retain”);
            The pdf_add_pdflink( ) function adds a link to another PDF file. It takes the same parameters as
            the pdf_add_locallink( ) function, with the addition of a new parameter containing the filename
            to link to:
            pdf_add_pdflink(pdf, llx, lly, urx, ury, filename, page, zoom);




            pdf_add_pdflink($p, 50, 700, 100, 750, “another.pdf”, 3, “retain”);
            The pdf_add_launchlink( ) function adds a link to another file, whose MIME type causes the
            appropriate program to be launched to view the file:
            pdf_add_launchlink($p, 50, 700, 100, 750, “/path/document.doc”);

            The pdf_add_weblink( ) function creates a link whose destination is a URL:
            pdf_add_weblink(pdf, llx, lly, urx, ury, url);



                                             LOVELY PROFESSIONAL UNIVERSITY                                   311
   312   313   314   315   316   317   318   319   320   321   322