1

I am operating on a RPi Model 3B with Jessie OS and Python version 2.7.9.

I am using XlsxWriter (ver1.1.0) to write an .xlsx file and then converting it to PDF using LibreOffice's conversion code, as follows:

libreoffice --headless --convert-to pdf /path/to/file.xlsx

I wrote hyperlink to a picture file using write_url() with URL argument which is just a 'Photo Name' in my case. The pictures files are located in the same directory alongside with the converted .pdf and .xlsx files.

When I open these files on my RPi, the hyperlinks have the correct path to the files and are clickable and they work in the default viewers Xpdf and LibreOffice.

When opening these files on a Windows 7 machine using USB drive, Excel interprets the path correctly and can open the file but PDF viewers such as Adobe Reader and FoxIt cannot open it.

They interpret the hyperlink as Linux hyperlink as follows:

'/media/folderName/etc/' instead of looking into the letter drive that Windows assigns to the USB like Excel can.

Excel knows how to look in the associated drive letter of the USB drive but it seems like PDF viewers are lost. I understand that this is most likely a problem with the fact that Linux and Windows can find external drives differently.

I turned this around by explicitly typing the entire file path including the drive letter of my particular drive, but obviously this doesn't work for different drives and if the user copy the folder with the files somewhere else. The resulting PDF when saving as PDF in Excel works, however this isn't a feasible workaround in my situation.

Is there any way to get PDF viewers to find the correct path? Or a Linux to Windows URL conversion that will work for both?

  • I have no experience in this domain, but you might try an more explicit url, eg file://PhotoName, or even file://./PhotoName. – meuh Sep 13 '18 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.