WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

question of download attachment

Open zsmatrix62 opened this issue 1 year ago • 3 comments

Hi,

Im able to embed the attachments using link tags like:

<link href="att.txt" rel="attachment" title="source" />
<link href="att.zip" rel="attachment" title="source" />

how can i make a link in my html template and then download it from generated pdf? currently when i use a tag with href="att.txt" it always links to local file path not embeded one.

Thanks.

zsmatrix62 avatar Mar 27 '24 09:03 zsmatrix62

Hi!

You can do this with <a href="att.txt" rel="attachment">test</a>. It will only work if your PDF reader supports the feature.

liZe avatar Mar 27 '24 12:03 liZe

Im using adobe acrobat reader but below codes does not work, the Download att.txt in my converted pdf is not clicable. ಥ_ಥ

do you have any exmaples of a full script? Thank you very much in advance!

<html>
  <head>
    <link rel="stylesheet" href="styles/sop-doc.css" />
    <link href="att.txt" rel="attachment" title="source" />
    <link href="att.zip" rel="attachment" title="source" />
  </head>
  <body>
    <a href="att.txt" rel="attachment" download="att.txt">Donwload att.txt</a>
</body>
</html>

zsmatrix62 avatar Mar 28 '24 02:03 zsmatrix62

Im using adobe acrobat reader but below codes does not work, the Download att.txt in my converted pdf is not clicable. ಥ_ಥ

I don’t have Acrobat Reader, but it works with my PDF reader. Maybe it’s not supported by Adobe Reader. Do you have another PDF that works with Adobe Reader?

liZe avatar Apr 25 '24 16:04 liZe

Please add a comment if there’s anything more we can do for you.

liZe avatar May 29 '24 15:05 liZe