pdfkit/docs/destinations.html
2025-04-16 16:22:41 +02:00

33 lines
3.2 KiB
HTML

<!DOCTYPE html><html><head><meta charset="utf-8"><title>Destinations</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a class="selected" href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="destinations">Destinations</h1>
<p>Anchor may specify a destination by <code>addNamedDestination(name, ...args)</code>, which consists of a page, the location of the display window on that page, and the zoom factor to use when displaying that page.</p>
<p>Examples of creating anchor:</p>
<pre><code>// Insert anchor for current page
doc.addNamedDestination(&#39;LINK&#39;);
// Insert anchor for current page with only horizontal magnified to fit where vertical top is 100
doc.addNamedDestination(&#39;LINK&#39;, &#39;FitH&#39;, 100);
// Insert anchor to display a portion of the current page, 1/2 inch in from the top and left and zoomed 50%
doc.addNamedDestination(&#39;LINK&#39;, &#39;XYZ&#39;, 36, 36, 50);
// Insert anchor for this text
doc.text(&#39;End of paragraph&#39;, { destination: &#39;ENDP&#39; });</code></pre>
<p>Examples of go to link to anchor:</p>
<pre><code>// Go to annotation
doc.goTo(10, 10, 100, 20, &#39;LINK&#39;)
// Go to annotation for this text
doc.text(&#39;Another goto&#39;, 20, 0, {
goTo: &#39;ENDP&#39;,
underline: true
});</code></pre><nav><a class="previous" href="/docs/forms.html">Previous</a><a class="next" href="/docs/attachments.html">Next</a></nav></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script src="/docs/js/scroll.js"></script><script src="/docs/js/highlight.pack.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-48340245-1', 'pdfkit.org');
ga('send', 'pageview');</script></body></html>