1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
|
% example of use of primitives provided by pdftex. high-level macros are
% provided by macros packages like LaTeX or ConTeXt
% This file was slightly modified by Staszek Wawrykiewicz for pdfTeX
% version 1.10 or newer.
% \let\makeheadline\empty
% \let\makefootline\empty
\def\pdfTeX{pdf\TeX}
\def\primitive#1{{\tt\char92\relax#1}}
\def\newpage{\vfill\eject}
\parindent=0pt
\input pdfcolor.tex % simple macros to use color with pdftex; color
% name derived from dvicolor.tex
% unless mentioned explicitly, the default value of a parameter
% is: 1) zero for integer/dimension parameters; 2) empty for tokens
% parameters
% integer parameters take their corresponding value (if given) from config
% file (pdftex.cfg) when pdftex starts
\pdfoutput=1 % positive value turns on PDF output;
% this parameter can not be changed after the pdf
% output has been opened
\pdfcompresslevel=6 % compression level for text and image; allowed
% values are 0..9
% 0 = no compression (default)
% 1 = fastest compression
% 9 = best compression
% 2..8 = something between
% numbers out of range will be fixed to the
% closest allowed value
\pdfdecimaldigits=3 % number of digits after decimal point for real
% number in pdf output; larger values produce
% better accuracy but also larger output size;
% allowed value are 0..5
\pdfmovechars=2 % 1 turns on moving lower chars 0..32 to higher
% slots for fonts with last char code < 128,
% 2 or larger even for fonts with last char code > 127
\pdfpkresolution=300 % resolution for bitmap (PK) fonts; allowed values
% are 72..1200, default is 600
\pdfuniqueresname=1 % positive value turns on prepending unique
% prefix for each named resources
% dimension parameters take their corresponding value (if given) from
% config file (pdftex.cfg) when pdftex writes the first page to the pdf
% output if they have not been set yet (or set to zero)
\pdfhorigin=1in % horizontal origin (offset);
% N.B.: setting this parameter to zero probably
% won't give the expected effect, as it will be
% overwritten by the corresponding value from the
% config file, which is often different from zero
% (typically it is 1in). The solution
% is to set the parameter to 1sp
\pdfvorigin=1in % vertical origin (offset); similar to \pdfhorigin
\pdfpagewidth=8.5in % paper size of the pdf output (letter in this case)
\pdfpageheight=11in
\pdflinkmargin=1pt % margin added to dimensions of link (see below)
\pdfdestmargin=10pt % margin added to dimensions of destination (see
% below)
\pdfthreadmargin=1em % margin added to dimensions of bead in article thread
% (see below)
\pdfpagesattr={/MyPageAttribute /MyValue}
% optional attributes for the root Pages object;
% all pages inherit these attributes
\pdfpageattr={/MyPagesAttribute /MyValue}
% optional attributes for individual pages;
% attributes specified here overwrite any
% attributes given by `\pdfpagesattr'
\pdfpageresources{/MyPageResourceAttribute /MyValue}
% optional attributes for resources of a page
% version of pdftex can be accessed via \pdftexversion and \pdftexrevision
This is version \the\pdftexversion \pdftexrevision\ of \pdfTeX.
% font resource in the pdf output has the form
% "/F<number> <object number> 0 R", where <number> is accessible via
% \pdffontname and <object number> via \pdffontobjnum
Font \fontname\font\ has resource name tag
\pdffontname\font\ and object number \pdffontobjnum\font\ in the PDF output.
% \pdfincludechars can be used to ensure certain characters to be
% included in the font file (normally only used characters are
% included)
\pdfincludechars\font{ABCDEF}
% pdftex ignores \special's text if \pdfoutput is set, unless they have
% prefix "pdf:" or "PDF:" (in this case the prefix is not written out, of
% course). \pdfliteral is intended to replace \special in pdf output mode.
Changing color can be done by inserting `raw' PDF code, like
\pdfliteral{0 1 1 0 k} % switch color to red; using \pdfliteral is
this. % recommended
\special{PDF:0 0 0 1 k} % switch color back to black; \special can be
% used with prefix "pdf:" or "PDF:"
% user-defined object can be inserted into the pdf output by \pdfobj. The
% object is written out as a dictionary, unless \pdfobj is used with
% "stream" option. An object created by \pdfobj is held in memory and will
% not be written to the pdf output, unless 1) the object is referenced by
% saying \pdfrefobj <object number>; or 2) \pdfobj is preceded by
% \immediate. The object number of the last object created by \pdfobj is
% accessible via \pdflastobj.
\pdfobj{Hello} % the simplest case: the object will be created
% as a dictionary
\pdfrefobj \pdflastobj % mark the object to be written out; it can be
% understood as a reference to the object
\immediate \pdfobj stream % create the object as a stream and write it to
{Hello} % the pdf output immediately
\pdfobj stream % create the object as a stream with
attr {/MyStreamAttribute /MyValue} % additional attributes
{Hello}
\pdfrefobj \pdflastobj
\pdfobj file {obj.dat} % read the object contents from file obj.dat
\pdfrefobj \pdflastobj
\pdfobj stream % read the stream contents from file obj.dat
file {obj.dat}
\pdfrefobj \pdflastobj
\pdfobj stream % read the stream contents from file obj.dat
attr {/MyStreamAttribute /MyValue} % with additional attributes
file {obj.dat}
\pdfrefobj \pdflastobj
% tex boxes can be written into so-called XObject form, which is very
% similar to a normal page in the pdf output. Additional data can be
% inserted to the XObject form dictionary as well as the Resource
% dictionary of the XObject form
\setbox0=\hbox{This is a box that is output as a XObject form}
\pdfxform
attr {/MyXObjectFormAttribute /MyValue}
resources {/MyXObjectFormResourceAttribute /MyValue}
0
% similarly to \pdfobj, the object created by \pdfxform is held in memory
% and is not written to the pdf output, unless 1) the object is referenced
% by saying \pdfrefxform <object number>; or 2) \pdfxform is preceded by
% \immediate. The object number of the last XObject form created
% by \pdfxform is accessible via \pdflastxform. Note that
% \immediate\pdfxform does not typeset anything; it just ensures that the
% XObject form is written out to the output. To display the form, it is
% necessary to say \pdfrefxform <object number> in the intended place.
% Another point is that \pdfrefxform acts similarly rather to rules than to
% boxes concerning dimensions and space setting. It's highly recommended to
% wrap \pdfrefxform in a box in order to ensure spacing will be correct.
\hbox{\pdfrefxform \pdflastxform}
\newpage
% images can be included with pdftex using \pdfximage. Supported formats
% are determined by file name extension:
% .pdf/.PDF: PDF
% .png/.PNG: PNG
% .jpg/.JPG/.jpeg/.JPEG: JPEG
%
% pdftex itself does not support EPS and PostScript codes at all; however,
% it's possible to include metapost output (see below).
\pdfximage {pic.pdf} % read image pic.pdf (from path TEXPSHEADERS)
% when a pdf image may have more than 1 page, the number of the last image
% opened by \pdfximage is accessible via \pdflastximagepages.
The last image has \the\pdflastximagepages\ page(s).
% It also possible to select which page to include. Pages are numbered from
% 1. Out-of-range values are fixed to 1 and bitmapped images have always 1
% page. To include let's say the 2nd page of a pdf image, one can use
% \pdfximage page 2 {file.pdf}
% similarly to \pdfobj, the image created by \pdfximage is held in memory
% and is not written to the pdf output, unless 1) the image is referenced
% by saying \pdfrefximage <object number>; or 2) \pdfximage is preceded by
% \immediate. The object number of the last image created by \pdfximage is
% accessible via \pdflastximage. Note that \immediate\pdfximage does not
% typeset anything; it just ensures that the image is written out to the
% output. To display the image, it is necessary to say
% \pdfrefximage <object number> in the intended place. Another point is
% \pdfrefximage act similarly rather to rules than to boxes concerning
% dimensions and space setting. It's highly recommended to wrap
% \pdfrefximage in a box in order to ensure spacing will be correct.
\hbox{\pdfrefximage \pdflastximage}
\smallskip
Inserted {\tt pic.pdf}
\smallskip
% the dimensions of the image can be also controlled via <rule spec>. The
% default values are zero for depth and `running' for height and width. If
% all of them are given, the image will be scaled to fit the specified
% values. If some of them (but not all) are given, the rest will be set to
% a value corresponding to the remaining ones so as to make the image size
% to yield the same proportion of width : (height + depth) as the original
% image size, where depth is treated as zero. If none of them is given then
% the image will take its natural size. An image inserted at its natural
% size often has a resolution of \pdfimageresolution (or 72 if
% \pdfimageresolution is set to zero) given in dots per inch in the output
% file, but some images may contain data specifying the image resolution,
% and in such a case the image will be scaled to the original resolution.
% The dimension of the image can be accessed by enclosing the \pdfrefximage
% command to a box and checking the dimensions of the box.
\pdfximage width 6cm {pic.png} % set the image width and keep the
\pdfrefximage \pdflastximage % `natural' proportion width : height
\smallskip
Inserted {\tt pic.png}
\smallskip
\pdfximage width 6cm height 4cm % set both image width and height; the
{pic.jpg} % final proportion width : height may be
% different from the `natural' one
\pdfrefximage \pdflastximage
\smallskip
Inserted {\tt pic.jpg}
\smallskip
\pdfimageresolution=72 % to open an image at 72 dpi
\pdfximage {pic.pdf}
\setbox0=\hbox{\pdfrefximage\pdflastximage} % get dimensions of the image
% in order to include the image
% at a specific resolution
\dimen0=.06\wd0 % calculate the image width at 1200 dpi (0.06 = 72/1200)
\pdfximage % include the image at resolution 1200 dpi
width \dimen0 {pic.pdf} % by setting image width to the calculated value
\pdfrefximage \pdflastximage
\smallskip
Inserted scaled {\tt pic.pdf}
\newpage
% thanks to Hans Hagen pictures created by metapost can be used with
% pdftex. The following files come from ConTeXt distribution. Another
% place to get them is http://www.tug.org/applications/pdftex/, where
% is also possible to get the latest driver file for using the LaTeX
% graphicx package with pdftex.
\input supp-mis.tex % supp-mis.tex is loaded by supp-pdf.tex
\input supp-pdf.tex % automatically, so the above line could be left
% out (it's given here to make clear what all files
% are needed to use \convertMPtoPDF)
% \convertMPtoPDF {filename} {x scale} {y scale}
% the figure cmr10.103 was created by running metapost on cmr10.mf
\convertMPtoPDF{cmr10.103}{2}{1}
\newpage
% It is possible to have metapost code inside the tex sources and call
% metapost to generate the figure before calling \convertMPtoPDF:
% define some contants that will be used in the metapost code
\def\pointA{(50, 50)}
\def\pointB{(400, 250)}
\newwrite\mpfile % temporary file for metapost code
\immediate \openout\mpfile = \jobname.mp
\immediate \write \mpfile {%
prologues := 1;
def drawleaf(expr A, B, C) =
pickup pencircle scaled 4bp;
draw (0, 0) {dir 60} .. A .. {dir 60} B withcolor C;
pickup pencircle scaled 2bp;
draw A {dir 75} .. {dir 45} B withcolor C;
draw A {right} .. {dir 75} B withcolor C;
enddef;
beginfig(0);
drawleaf(\pointA, \pointB, .6green);
d := .5 xpart \pointB;
currentpicture := currentpicture reflectedabout ((d, 0), (d, 1));
endfig;
beginfig(1);
drawleaf(\pointA, \pointB, .6blue);
currentpicture := currentpicture reflectedabout (\pointA, \pointB);
endfig;
end;
}
\immediate \closeout \mpfile % close the file before running metapost
% now we call metapost to generate the ps output; this is system-dependent
% and has been tested for web2c only. It is necessary to have
%
% shell_escape = t
%
% in texmf.cnf in order to run it.
\immediate \write 18 {mpost \jobname.mp} % call metapost on \jobname.mp
\convertMPtoPDF{\jobname.0}{1}{1}
\convertMPtoPDF{\jobname.1}{1}{1}
\newpage
% EPS pictures cannot be inserted directly by pdftex, but it's possible to
% convert them to PDF using a PostScript-to-PDF converter, like Acrobat
% Distiller or Ghostscript. The below example calls epstopdf (available
% from http://www.tug.org/applications/pdftex), which preprocesses the EPS
% and afterwards uses Ghostscript to convert to PDF. In order to convert
% EPS with embedded Type 1 fonts, Ghostscript version 6.50 or newer is
% required.
%\immediate \write 18 {epstopdf --outfile=tmp.pdf cmr10.103} % call epstopdf
\pdfximage height \vsize {tmp.pdf} % insert the PDF converted from EPS
\hbox{\pdfrefximage \pdflastximage}
\newpage
% some text to try using threads
\def\text{%
Ah! perhaps a burning match might be some good, if she could draw it from
the bundle and strike it against the wall, just to warm her fingers. She
drew one out---"scratch!" how it sputtered as it burnt! It gave a warm,
bright light, like a little candle, as she held her hand over it. It was
really a wonderful light. It seemed to the little girl that she was sitting
by a large iron stove, with polished brass feet and a brass ornament. How
the fire burned! and seemed so beautifully warm that the child stretched
out her feet as if to warm them, when, lo! the flame of the match went out,
the stove vanished, and she had only the remains of the half-burnt match in
her hand.
She rubbed another match on the wall. It burst into a flame, and
where its light fell upon the wall it became as transparent as a veil,
and she could see into the room. The table was covered with a snowy
white table-cloth, on which stood a splendid dinner service, and a
steaming roast goose, stuffed with apples and dried plums. And what
was still more wonderful, the goose jumped down from the dish and
waddled across the floor, with a knife and fork in its breast, to
the little girl. Then the match went out, and there remained nothing
but the thick, damp, cold wall before her.
She lighted another match, and then she found herself sitting
under a beautiful Christmas-tree. It was larger and more beautifully
decorated than the one which she had seen through the glass door at
the rich merchant's. Thousands of tapers were burning upon the green
branches, and colored pictures, like those she had seen in the
show-windows, looked down upon it all. The little one stretched out
her hand towards them, and the match went out.
The Christmas lights rose higher and higher, till they looked to
her like the stars in the sky. Then she saw a star fall, leaving
behind it a bright streak of fire. "Some one is dying," thought the
little girl, for her old grandmother, the only one who had ever
loved her, and who was now dead, had told her that when a star
falls, a soul was going up to God.
She again rubbed a match on the wall, and the light shone round
her; in the brightness stood her old grandmother, clear and shining,
yet mild and loving in her appearance. "Grandmother," cried the little
one, "O take me with you; I know you will go away when the match burns
out; you will vanish like the warm stove, the roast goose, and the
large, glorious Christmas-tree." And she made haste to light the whole
bundle of matches, for she wished to keep her grandmother there. And
the matches glowed with a light that was brighter than the noon-day,
and her grandmother had never appeared so large or so beautiful. She
took the little girl in her arms, and they both flew upwards in
brightness and joy far above the earth, where there was neither cold
nor hunger nor pain, for they were with God.
}
\pdfannot % generic annotation
%
width 10cm % the dimension of the annotation can be controlled
height 0cm % via <rule spec>; if some of the dimensions in
depth 4cm % <rule spec> is not given, the corresponding
% value of the parent box will be used.
{ %
/Subtype /Text % text annotation
% /Open true % if given then the text annotation will be opened
% by default
/Contents % text contents
(This text is from THE LITTLE MATCH-SELLER by Hans Christian
Andersen)
}
\def\colsep{\qquad} % column separator
\setbox0=\vbox{%
\baselineskip=1.2em
\hsize=2in
\tolerance=1000
\rightskip=0pt plus 1em
\hfuzz=1em
\parskip=\baselineskip
\null % will use \vsplit to remove this null box and
% insert \splittopskip glue to to top of the
% first column. I don't know how to make the
% first column have the same height as other
% columns so have to use this trick to ensure
% that all columns will have \splittopskip glue
% properly inserted at the top
\text}
\setbox1=\vsplit0 to 0pt % remove the null box and insert \splittopskip glue
\setbox3=\copy0 % make a copy of box0 for later use
% using thread by explicit determination which boxes will belong to a thread
\setbox2=\hbox{}
\loop
\setbox1=\vsplit0 to .7\vsize
\setbox2=\hbox{\unhbox2 \vtop{%
\pdfthread % add a bead to the thread with id=`num 1' (given
% below)
% <rule spec> % dimensions of the bead can be controlled
% via <rule spec>; if some of dimensions in
% <rule spec> are not given, the corresponding
% value of the parent box will be used. If
% \pdfthreadmargin is not zero then its value
% will be added to the margins of the bead
%
% additional attributes of thread
attr {/I <</Title (THE LITTLE MATCH-SELLER by Hans Christian)>>}
%
% identifier specification (exactly one of the
% following must be specified):
%
num 1 % num identifier (must be positive), or
% name {thread1} % name identifier; \pdfthread with the same id
% will be joined together. Attributes of the
% final thread is the last one if any was given.
\unvbox1}\colsep}
\ifdim \ht0 > 0pt \repeat
\box2
\newpage
% using thread by automatic determination which boxes will belong to a
% thread; \pdfstartthread has the same syntax as \pdfthread, apart that it
% must be followed by a \pdfendthread. \pdfstartthread and the
% corresponding \pdfendthread must end up in vboxes with the same
% nesting level; all vboxes between them will be added into the thread.
% Note that during output rutine if there are other newly created boxes
% which have the same nesting level as the vbox/vboxes containing
% \pdfstartthread and \pdfendthread, they will be also added into the
% thread, which is propably not what we want. To avoid such unconsidered
% behaviour, it's often enough to wrap boxes that shoudn't belong to the
% thread by a box to change their box nesting level.
\setbox0=\vbox{%
\pdfstartthread
attr {/I <</Title (THE LITTLE MATCH-SELLER by Hans Christian)>>}%
name {thread2}%
\unvbox3
\pdfendthread}
\setbox2=\hbox{}
\loop
\setbox1=\vsplit0 to .7\vsize
\setbox2=\hbox{\unhbox2 \vtop{\unvbox1}\colsep}
\ifdim \ht0 > 0pt \repeat
\box2
\newpage
\pdfdest % destination for link and outlines
%
% identifier specification (exactly one of the
% following must be specified):
%
num 1 % num identifier (must be positive), or
% name {dest1} % name identifier. Must be unique in one document.
%
% appearance of destination (exactly one of the
% following must be specified):
%
fit % fit whole page in window
% fith % fit whole width of page
% fitv % fit whole height of page
% fitb % fit whole "Bounding Box" page
% fitbh % fit whole width of "Bounding Box" of page
% fitbv % fit whole height of "Bounding Box" of page
% fitr <rule spec> % fit the rectangle specified by <rule spec>; if
% some of dimensions in <rule spec> is not given,
% the corresponding value of the parent box will be
% used. If \pdfdestmargin is not zero then its
% value will be added to the margins of the
% rectangle
This is a page containing destination `num 1'
\newpage
% \pdfstartlink and \pdfendlink are similar to \pdfstartthread and
% \pdfendthread, but they must end up in hboxes instead of vboxes
\leftline{This is a link to destination
\pdfstartlink % start a link
%
height 10pt % dimensions of the link can be controlled
depth 3pt % via <rule spec>; if some of the dimensions in
% <rule spec> are not given, the corresponding
% value of the parent box will be used. If
% \pdflinkmargin is not zero then its value
% will be added to the margins of the link.
%
attr{/C [0.9 0 0] % additional attributes of link
/Border [0 0 2]} %
%
% action specification (exactly one of the
% following must be specified):
%
goto % goto action
%
% file{file.pdf} % optional file specification; can be used only with
% `goto' action or `thread' action (see below). If
% action identifier is name then there should be a
% destination or a thread with same name identifier
% in the file; if action identifier is number then it
% means page number for `goto' action (in this case it
% will take effect as `fitb' specification) and index
% number of thread for `thread' action (the first
% thread in a document has index number 0)
%
% goto action identifier (exactly one of the following
% must be specified):
%
num 1 % goto destination with num identifier
% name{dest1} % goto destination with name identifier
% page 1 {/Fit} % goto page 1 and fit the whole page
%
%
% thread % thread action; start to read a thread
%
%file{file.pdf} % optional file specification
%
% thread action type (exactly one of the following
% must be specified):
%
% num 1 % read thread with num identifier id=`num 1'
% name{thread2} % read thread with name identifier id=`name{thread2}'
%
%
% user{ % user-defined action; a URI action can be specifed
% % as below
% /Subtype /Link
% /A <<
% /Type /Action
% /S /URI
% /URI (http://www.tug.org/)
% >>}
`num 1'%
\pdfendlink % end of link; if \pdfstartlink and
% \pdfendlink end up in different hboxes (in this
% case the boxes must have the same box nesting
% level), all hboxes between them will be treated
% as part of the link. Line breaks and even page
% breaks are allowed between \pdfstartlink and
% \pdfendlink
}
% more uses of links
\leftline{%
This is a link to the
\pdfstartlink
goto
page 1 {/FitB}% % goto the 1st page and fit the page BBox in the
% window
first page%
\pdfendlink}
\leftline{%
This is a link to the
\pdfstartlink
thread num 1 % read the thread `num 1'
thread `num 1'%
\pdfendlink}
\leftline{%
This is a link to
\pdfstartlink
attr{ /Border [0 0 0]} % make the bbox of the link invisible
user {% % a named action (undocumented in PDF spec)
/Subtype /Link
/A <<
/S /Named
/N /GoBack
>>}%
\Cyan the previous view\Black % color text inside the link
\pdfendlink}
\leftline{%
This is a link to
\pdfstartlink user{%
/Subtype /Link
/A <<
/Type /Action
/S /URI
/URI (http://www.fi.muni.cz/)
>>}%
\Red our faculty\Black
\pdfendlink}
{\hsize2in \raggedright \noindent
This is an example of
\pdfstartlink
attr{ /Border [0 0 0]} % make the bbox of the link invisible
goto page 1 {/FitB}%
\Red multiple line link. Make sure that the link and
its end must be in horizontal mode and the parent boxes must have the
same box nesting level.\Black
\pdfendlink
A common mistake here is using \primitive{pdfstartlink} at the
beginning of the text without \primitive{indent}, \primitive{noindent}
or \primitive{leavevmode}, so \primitive{pdfstartlink}
will end up in vertical mode and cause an error.
\par}
% a sound or movie annotation can be created as below. Using such kinds of
% annotation or Java script causes the pdf output to be system-dependent.
% More info about this topic can be found in PDF spec.
% \leftline{%
% \pdfannot width 4in height 0in depth 3in {%
% /Subtype /Movie
% /Movie << /F (MyMovieFile.mov) >>}
% An example of movie annotation}
% \leftline{%
% \pdfannot width 0in height 0in depth 0in {%
% /Subtype /Sound
% /Sound << /F (MySoundFile.wav) >>}
% An example of sound annotation}
% outlines (bookmarks):
\pdfoutline % outline entry specification
%
goto num 1 % action specification. This is the same as the action
% specification of `\pdfstartlink'
%
count 3 % number of direct subentries of this entry, 0 if this
% entry has no subentries (in this case it may be
% omitted). If after `count' follows an negative number
% then all subentries will be closed and the absolute
% value of this number specifies the number of
% direct subentries (see the following entries)
%
{Outline 1} % text contents of outline entry
\pdfoutline goto num 1 count -2{Outline 1.1}
\pdfoutline goto num 1 {Outline 1.1.1}
\pdfoutline goto num 1 {Outline 1.1.2}
\pdfoutline goto num 1 {Outline 1.2}
\pdfoutline goto num 1 {Outline 1.3}
\pdfoutline goto num 1 {Outline 2}
\newpage
% Transformations are done by changing transformation matrices. See PDF manual
% for more details how to use it. Generally, a transformation matrix is given
% as six real numbers followed by operator `cm'. Before doing any
% transformation we must store current graphic state (by operator `q')
% and restore it (by operator `Q') after transformation. See examples below.
% Make sure that *no spacing* can be produced during transformation and
% afterwards we must adjust spacing `by hand'.
\setbox0=\vbox{
\hbox{Rotated text}
\hbox{Rotated text}
\hbox{Rotated text}
}
\setbox1=\vbox{
\hbox{Scaled text}
\hbox{Scaled text}
\hbox{Scaled text}
}
\setbox2=\vbox{
\hbox{Skewed text}
\hbox{Skewed text}
\hbox{Skewed text}
}
\newdimen\d
\newbox\tmpbox
\def\avoidboxdimen#1{%
\setbox\tmpbox=\hbox{\box#1}%
\wd\tmpbox=0pt
\ht\tmpbox=0pt
\dp\tmpbox=0pt
\box\tmpbox}
\hrule
% rotation by `t' degrees counterclockwise is specified as
% `cos(t) sin(t) -sin(t) cos(t) 0 0'.
\vskip\wd0
\leftline{\hskip\ht0\hskip\dp0%
\pdfliteral{q 0 1 -1 0 0 0 cm}%
\avoidboxdimen0
\pdfliteral{Q}}
\hrule
% scaling is specified as `Sx 0 0 Sy 0 0'
\d=\ht1 \advance\d by \dp1
\vskip3\d
\pdfliteral{q 2 0 0 3 0 0 cm}%
\avoidboxdimen1
\pdfliteral{Q}%
\hrule
% skewing x-axis by `u' degrees and y-axis by `v' degrees is specified as
% `1 tan(u) tan(v) 1 0 0'.
\d=\ht2 \advance\d by \dp2
\vskip\d
\d=0.57735\wd2 %tan(30) = 0.57735
\pdfliteral{q 1 -0.57735 0 1 0 0 cm}%
\avoidboxdimen2
\pdfliteral{Q}
\vskip\d
\pdfinfo{ % Info dictionary of PDF output;
% all keys are optional.
/Author (Han The Thanh)
/CreationDate (D:20000112000000) % (D:YYYYMMDDhhmmss)
% YYYY year
% MM month
% DD day
% hh hour
% mm minutes
% ss seconds
%
% default: the actual date
%
/ModDate (D:20021227020000) % ModDate is similar
/Creator (TeX) % default: "TeX"
/Producer (pdfTeX) % default: "pdfTeX" + pdftex version
/Title (example.pdf) %
/Subject (Example) %
/Keywords (PDF TeX) %
}
\pdfcatalog{ % Catalog dictionary of PDF output.
/PageMode /UseOutlines %
/URI (http://www.fi.muni.cz/) %
% pdfscreen-like setting might look like:
% /PageMode /none
% /ViewerPreferences <<
% /HideToolbar true
% /HideMenubar true
% /HideWindowUI true
% /FitWindow true
% /CenterWindow true
% >>
}
openaction goto page 1 {/Fit} % the action to activate when open
% the document; this is the same as
% <action spec> for links and
% outlines
\bye
|