Hello,

I just installed the module on the production version. The images are not displayed in PDF files. I use the dompdf library.

Here is the result of a PDF file generated by the module:
http://www.carmelo-crea.net/printpdf/34

Thank you in advance for your help!

Comments

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

"Access denied"

Clément’s picture

Oops, sorry. That now you have permissions. (the 2 images that work are links pointing to YouTube for a test (not hosted on the server))

jcnventura’s picture

OK, This is what I see:

The first image is
http://1.1.1.4/bmi/www.carmelo-crea.net/sites/default/files/styles/galle...

Assuming that your $base_url (a global Drupal variable) is http://www.carmelo-crea.net, there's no way that the module is doing it's try-to-convert-to-local-filename algorithm. As such, it seems that your webserver is able to open the last two files, but not the initial ones.

If on the other hand, that URL is the result of some performance booster, can you provide the following:

1. The img src as Drupal sees it.
2. The real path of the file

Clément’s picture

The base URL is present in the url of my pictures on the page (http://www.carmelo-crea.net/showroom).

Here is an excerpt from the HTML generated by Drupal in the node:

<ul class="gallerie-node"><li><a href="http://www.carmelo-crea.net/sites/default/files/styles/img-grand/public/images/showroom/00.jpg" target="blank" rel="clearbox[gallery=galerie-,,title=]" title=""><img src="http://www.carmelo-crea.net/sites/default/files/styles/gallerie-node/public/images/showroom/00.jpg" alt="" /></a></li><li><a href="http://www.carmelo-crea.net/sites/default/files/styles/img-grand/public/images/showroom/01.jpg" target="blank" rel="clearbox[gallery=galerie-,,title=]" title=""><img src="http://www.carmelo-crea.net/sites/default/files/styles/gallerie-node/public/images/showroom/01.jpg" alt="" /></a></li><li><a href="http://www.carmelo-crea.net/sites/default/files/styles/img-grand/public/images/showroom/02.jpg" target="blank" rel="clearbox[gallery=galerie-,,title=]" title=""><img src="http://www.carmelo-crea.net/sites/default/files/styles/gallerie-node/public/images/showroom/02.jpg" alt="" /></a></li><div class="clear-both"></div></ul>

Directory files and these children are in CHMOD 777

Thank you for your help.

jcnventura’s picture

It is possible that the module is doing it's replacement to access the file locally.

It's accessing at /sites/default/files/styles/gallerie-node/public/images/showroom/00.jpg

Where is the location of the drupal index.php file.

If the files are there usually dompdf is able to access them.

Clément’s picture

I think I found the problem.
Here's what the error log shows:

Notice : Undefined variable: base_url dans print_pdf_generate_path() (ligne 82 dans /var/www/vhosts/carmelo-crea.net/httpdocs/sites/all/modules/print/print_pdf/print_pdf.pages.inc).

Notice : Undefined variable: node dans print_pdf_controller() (ligne 34 dans /var/www/vhosts/carmelo-crea.net/httpdocs/sites/all/modules/print/print_pdf/print_pdf.pages.inc).

Apparently the root path is not defined in the module line 82.

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks for your help!

Indeed, I noticed and fixed that problem 4 days ago. If you get the latest version, you'll probably get the images correctly (fingers crossed! :) )

Clément’s picture

Thank you for what you do.

I'm really sorry but despite updating the links does not work. I have no notice of the module.

jcnventura’s picture

Status: Fixed » Postponed (maintainer needs more info)

if it wasn't the above, then I really need more info..

From #5:
It is possible that the module is doing it's replacement to access the file locally.

It's accessing at __somewhere__/sites/default/files/styles/gallerie-node/public/images/showroom/00.jpg

Where __somewhere__ is the location of the drupal index.php file.

Are the files there?

Clément’s picture

I'm not sure I understand the question.

Index.php Drupal is at the root of the site.

Here are the installation site:
index.php
sites/default/
sites/default/settings.php
sites/default/files/
sites/default/themes/
sites/default/tmp/ <- Cache pdf
sites/all/modules/
sites/all/modules/print
sites/all/modules/print/lib/dompdf

All images from external domains to work, by against images hosted on the site domain does not.
example:
http://www.other-domain/image.jpg -> work
http://www.site-domain/image.jpg -> does not work

jcnventura’s picture

The question is simple. Is there a file called 00.jpg in sites/default/files/styles/gallerie-node/public/images/showroom ?

Clément’s picture

Yes, I confirm (FTP: /httpdocs/sites/default/files/styles/gallerie-node/public/images/biens-immobilier/00.jpg)

I just realized that this host does apparently only to CHMOD 664 on files.
It could be the problem...

jcnventura’s picture

You haven't really confirmed it... showroom is not really the equal to biens-immobilier

dompdf running as your web server is looking for the file in __path__/showroom/00.jpg where __path__ seems to be /httpdocs/sites/default/files/styles/gallerie-node/public/images/

You're telling me it's in __path__/biens-immobilier/00.jpg.

Clément’s picture

Sorry for the error of inatention...

The file on the server from the FTP is:
/httpdocs/sites/default/files/styles/gallerie-node/public/images/showroom/00.jpg

The image is well represented at this URL (url not rewritten):
http://carmelo-crea.net/sites/default/files/styles/gallerie-node/public/...

jcnventura’s picture

I have no idea why it didn't find the file.. I guess there's some reason for it, but it totally escapes me.. However, you might want to try the latest version.. By default, this version now tries to access the file via URL open.

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further info in two weeks. Closing the issue.

nguyentran’s picture

Thank you, change the permission on folder is working for me.