Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-8978

PDF Export does not handle XWiki links to attached files properly

    XMLWordPrintable

Details

    • Unit, Integration
    • Unknown
    • N/A
    • N/A

    Description

      Attach a test file to a page (test.pdf)
      Link to the attached file using attach:test.pdf

      Export to PDF. The link won't be clickable.

      The reason is that any attachment links are transformed by PDFUrlFactory to file:// links and the file copied to the file system before we pass it to XML-FO.
      We do this so that images are included in the PDF even if the wiki is private.

      Now if the attachment is a link (attach: or even html with links created using $doc.getAttachmentURL) and not an embedded image (image: or html image tag with $doc.getAttachmentURL) then instead of doing the local link we should leave an absolute HTTP link to the PDF (unless we know how to make XML-FO make embedded links we could be another solution).

      However it's complicated to know in which case we are for sure.
      We could either:

      • know if it's an image: or attach: syntax (but this would not handle html)
      • make PDFUrlFactory create absolute references + absolute URLs + local file URLs and return them serialized and then have the HTML postprocessing look for "a href" and "img src" tags and transform that data do the proper URL (local or absolute) transformation.

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              ludovic Ludovic Dubost
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: