Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed media as file annotation #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

michael-dev
Copy link

Hi,

these changes let dw2pdf optionally embed media files in the pdf output.

Regards,

if($AUTH >= AUTH_READ && $confAttachment) {
$file = mediaFN($src);
$filename = basename($file);
$out .= "<annotation file=\"".htmlspecialchars($file)."\" content=\"".htmlspecialchars($title)."\" icon=\"Paperclip\" title=\"Anhang: ".htmlspecialchars($filename)."\"/>&nbsp;&nbsp;&nbsp;";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an untranslated "Anhang" in there.

@splitbrain
Copy link
Owner

Can you explain what this is supposed to do? From the settings it seems it should work on linked media files only but the code seems to run for embedded images as well?

@michael-dev
Copy link
Author

Thanks for pointing out the missing translation. This is fixed now.

This patch is supposed to attach every media file where dokuwiki would create a media link, currently these are mostly pdf files in my wiki. This does (at least in my wiki) not include images that get inlined into the page - they are already handled by dw2pdf.

@Klap-in
Copy link
Collaborator

Klap-in commented Jun 22, 2015

<annotation>-tag is a custom tag of the mPDF library: http://mpdf1.com/manual/index.php?tid=284

Todo:

  • If I understand this annotation, the media files are included in the exported pdf. This means that cache expiring should depend on these files as well (only when included) . The cache name should depends on the attachment config value as well.

Questions:

  • when the file is generated the file permissions are checked. Are there scenarios where people can download a cached pdf, while the acl for certain files are changed?
  • I think a url-parameter for enabling embedded media is a consistent addition (other config options has also their url parameter). Is this a possible security and/or performance issue? Should config attachment has the choices: Yes, No, Never. Where the Yes and No are overridable by urlparameter, but the Never not?
  • Are all types of media files included in the pdf, is this desired and meaningful? for example: a powerpoint and word file are included as well?
  • for my curiosity to the result: can you share a pdf with some annotations? (sofar I still have to figure out howto simply fork a fork at github, for testing)

@splitbrain
Copy link
Owner

To answer your first question: yes it's possible media files can leak through cached PDFs. That's what the nocache option is for (and it's mentioned in it's description). Might be worth to make that more clear on the wiki page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants