{"route":"/en-US-v0.14.1/reference/pdf/attach/","title":"Attach","description":"Documentation for the `attach` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"notes","name":"Notes","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-path","name":"path","children":[]},{"id":"parameters-data","name":"data","children":[]},{"id":"parameters-relationship","name":"relationship","children":[]},{"id":"parameters-mime-type","name":"mime-type","children":[]},{"id":"parameters-description","name":"description","children":[]}]}],"body":{"kind":"func","content":{"path":["pdf"],"name":"attach","title":"Attach","keywords":["embed"],"oneliner":"A file that will be attached to the output PDF.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>A file that will be attached to the output PDF.</p>\n<p>This can be used to distribute additional files associated with the PDF\nwithin it. PDF readers will display the files in a file listing.</p>\n<p>Some international standards use this mechanism to attach machine-readable\ndata (e.g., ZUGFeRD/Factur-X for invoices) that mirrors the visual content\nof the PDF.</p>\n<h2 id=\"example\">Example</h2>\n<pre><code><span class=\"typ-pol\">#</span><span class=\"typ-pol\">pdf</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">attach</span><span class=\"typ-punct\">(</span>\n  <span class=\"typ-str\">&quot;experiment.csv&quot;</span><span class=\"typ-punct\">,</span>\n  relationship<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;supplement&quot;</span><span class=\"typ-punct\">,</span>\n  mime-type<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;text/csv&quot;</span><span class=\"typ-punct\">,</span>\n  description<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;Raw Oxygen readings from the Arctic experiment&quot;</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n</code></pre>\n<h2 id=\"notes\">Notes</h2>\n<ul>\n<li>This element is ignored if exporting to a format other than PDF.</li>\n<li>File attachments are not currently supported for PDF/A-2, even if the\nattached file conforms to PDF/A-1 or PDF/A-2.</li>\n</ul>"}],"self":false,"params":[{"name":"path","details":[{"kind":"html","content":"<p>The <a href=\"/en-US-v0.14.1/reference/syntax/#paths\">path</a> of the file to be attached.</p>\n<p>Must always be specified, but is only read from if no data is provided\nin the following argument.</p>"}],"types":["str"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"data","details":[{"kind":"html","content":"<p>Raw file data, optionally.</p>\n<p>If omitted, the data is read from the specified path.</p>"}],"types":["bytes"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"relationship","details":[{"kind":"html","content":"<p>The relationship of the attached file to the document.</p>\n<p>Ignored if export doesn't target PDF/A-3.</p>"}],"types":["none","str"],"strings":[{"string":"source","details":"<p>The PDF document was created from the source file.</p>"},{"string":"data","details":"<p>The file was used to derive a visual presentation in the PDF.</p>"},{"string":"alternative","details":"<p>An alternative representation of the document.</p>"},{"string":"supplement","details":"<p>Additional resources for the document.</p>"}],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"mime-type","details":[{"kind":"html","content":"<p>The MIME type of the attached file.</p>"}],"types":["none","str"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"description","details":[{"kind":"html","content":"<p>A description for the attached file.</p>"}],"types":["none","str"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true}],"returns":["content"],"scope":[]}}}