link element
The link tag is used to include external files into your document - specifically stylesheets and fonts.
Although identical in purpose to the HTML "link" tag, we've given the attributes more appropriate names.
To link an external CSS stylesheet:
- the type attribute must be set to "stylesheet"
- the src attribute must be set to the URL of a CSS stylesheet.
To link an external TrueType font: - the type attribute must be set to "font"
- the subtype attribute must be set to "TrueType"
- the name attribute must be set the name you will reference the font by.
- the src attribute must be set to the URL of the fontfile.
- the src-italic attribute may optionally be set to the URL of the file containing the italic variation of the font.
- the src-bold attribute may optionally be set to the URL of the file containing the bold variation of the font.
- the src-bolditalic attribute may optionally be set to the URL of the file containing the bold-italic variation of the font.
- the embed attribute may optionally be set to "true" or "false", to embed the font. The default is "true"
- the subset attribute may optionally be set to subset the font if it's embedded. The default is "true". If embed is false, this has no effect
To link an external Type 1 font: - the type attribute must be set to "font"
- the subtype attribute must be set to "Type1"
- the name attribute must be set the name you will reference the font by.
- the src attribute must be set to the URL of the AFM file for the font.
- the src-italic attribute may optionally be set to the URL of the AFM file for the italic variation of the font.
- the src-bold attribute may optionally be set to the URL of the AFM file for the bold variation of the font.
- the src-bolditalic attribute may optionally be set to the URL of the AFM file for the bold-italic variation of the font.
- the pfbsrc attribute may optionally be set to the URL of the PFB file for the font, if it's to be embedded.
- the pfbsrc-italic attribute may optionally be set to the URL of the PFB file for the italic variation of the font, if it's to be embedded.
- the pfbsrc-bold attribute may optionally be set to the URL of the PFB file for the bold variation of the font, if it's to be embedded.
- the pfbsrc-bolditalic attribute may optionally be set to the URL of the PFB file for the bold-italic variation of the font, if it's to be embedded.
To link an attachment to the PDF: - the type attribute must be set to "attachment" or "attachment/NNN", where NNN is the attachment relationship - usually one of "source", "alternative", "data", "supplement", "formdata" or "schema"
- the src attribute must be set to the URL of the attachment.
- the subtype attribute may be set to the media-type of the attachment, eg "application/pdf"
- the name attribute may be set to the name the attachment should be stored as, otherwise it will be derived from the URL
- the title attribute may be set to a description of the attachment
This is how to embed a CSS stylesheet
<link type="stylesheet" src="styles.css"/>
This is how to embed a TrueType font with all the variations.
<link type="font" name="mytimes" subtype="TrueType" src="times.ttf" src-bold="timesb.ttf"
src-italic="timesi.ttf" src-bolditalic="timesbi.ttf"/>
Or, if you are 100% sure won't need the italic or bold variations, you can leave them out.
<link type="font" name="ocrfont" subtype="TrueType" src="ocrfont.ttf"/>
This is how to embed a Type1 font with just the basic variation.
<link type="font" name="charter" subtype="Type1" src="charter.afm" pfbsrc="charter.pfb"/>
This shows is how to attach an XLS file to the PDF.
<link type="attachment/data" name="data.xls" subtype="application/vnd.ms-excel" src="file:///path/to/filename.xls"/>