DocRaptor is able to load the CSS but cannot load images. Here are 2 examples from the log.
msg|inf||loading image: /home/my_domain/public_html/my_domain.com/sites/default/files/images/slide1.jpg
msg|wrn|/home/my_domain/public_html/my_domain.com/sites/default/files/images/slide1.jpg|can't open input file: No such file or directory
msg|inf||loading image: /home/my_domain/public_html/my_domain.com/misc/watchdog-warning.png
msg|wrn|/home/my_domain/public_html/my_domain.com/misc/watchdog-warning.png|can't open input file: No such file or directory
Wondering why the URL isn't absolute i.e. http://my_domain.com/sites/default/files/images/slide1.jpg
Comments
Comment #1
apmsooner CreditAttribution: apmsooner commentedSounds more like a configuration issue on how files are being rendered on the node. You might try hardcoding the img tag in the body of the node and see if docraptor takes it. Might also check the view mode for the print display to see how the image is rendering... ie; try original image instead of cached style since that styled image might not exist until the node has saved and image is viewed.
Comment #2
bisonbleu CreditAttribution: bisonbleu commentedHum...
I'm using the Insert module on the Basic Page content type.
In the insert settings, I've checked the option Use absolute paths. The HTML source of the printer-friendly page shows a correct absolute URL to the original image (no style)
http://my_domain.com/sites/default/files/images/diapositive1.jpg
. I can load this image when I paste this URL in my browser. But DocRaptor says No such file or directory.I've tried unchecking Use absolute paths. The HTML source of the printer-friendly page shows a correct relative URL
/sites/default/files/images/diapositive1.jpg
. But DocRaptor says No such file or directory.Resetting to Use absolute paths.
If I revert the Print settings to use mPDF instead of Docraptor. The image is included in the PDF.
I've also enabled and configured the Print view mode for Basic Page. But DocRaptor says No such file or directory.
My website is running from a subfolder. So in settings.php, I've set $base_url = 'http://my_domain.com'; but nothing changes.
Darn... where's my T-Rex laser gun! ;-)
update 1: Tested on a different server where Drupal is installed in 'public_html' but where images are stored in private://images. Same problem: No such file or directory.
update 2: Tested on yet another server where Drupal is installed in 'public_html' but where images are stored in public://images. Works like a charm!
So it appears that my issue is related to the fact that my website is private (and needs to be): users are required to log in and all medias & files are stored using Drupal's Private file system path.
So the question becomes can docraptor_pdf_library be used for private websites?
Comment #3
apmsooner CreditAttribution: apmsooner commentedAnything you want a third party interface to have access to needs to be publicly accessible so... no if your files are in private folder, docraptor will not be able to access them.
Comment #4
apmsooner CreditAttribution: apmsooner commentedComment #5
bisonbleu CreditAttribution: bisonbleu commentedReopening and changing category and component to Support request/Documentation (i.e. not a bug).
Yes and no. I can see at least one option that would work when using Drupal's private file system is a must: replacing images with inline data URI. These data URI can be directly inserted in the HTML; that works for sensitive files.
They can also be loaded in CSS; that's ok for not so sensitive files such as icons.
The most interesting page I found on Drupal is Data URI Creator's project page. Lots of information worth reading.
Cheers!
Comment #6
apmsooner CreditAttribution: apmsooner commentedCool, please try that out and report back how it works out.
Comment #7
bisonbleu CreditAttribution: bisonbleu commentedSo if anybody is interested, it is possible to send images stored in Drupal's private file system to an external service such as DocRaptor using Image Base64 Formatter.
That's it. Works great with DocRaptor PDF Library : )
For more flexibility, consider creating a field collection with unlimited values made up of a Long text and an Image field. Then add items as required.
Comment #8
apmsooner CreditAttribution: apmsooner commented