After hearing you saying many times that dompdf has problems, I decided to switch to TCPDF. It works better for me now, but I still got this error

TCPDF ERROR: [Image] No such file or directory in /home/greatbre/public_html/sites/default/files/images/Product%20-%20Founders%20Red's%20Rye.preview.jpg

You can test it here. Printer-friendly version works fine. But PDF reported the error.

http://greatbrewers.com/list/47413

Comments

boabjohn’s picture

My impression is that the problems with images (and I have them as well) is somehow wrapped up in the 3rd party PDF utilities, thus there is little chance of problem resolution through this channel.

I have tried both dom and TCPDF and get different (but fatal) errors with each. It doesn't look like there's an easy solution through either utility.

Here's a sample error from my site:
TCPDF ERROR: [Image] No such file or directory in /home/boab-info/htdocs/drupal/sites/ruralpracticechange.boab.info/files/00-intro-title-campbell-sm.jpg?1229090688

Note: there is an image called "00-intro-title-campbell-sm.jpg" in the path specified, but what the "?1229090688" means or where it comes from is totally opaque to me.

THEREFORE: my question (without breaking the intent of the current thread) is to ask...is there a way to selectively include/hide the Print PDF option on selected content types?

This will allow me to provide PDF options on types where it currently works (eg, simple css, low image load) and avoid it on content types where I have known problems.

Thanks,

JB

jcnventura’s picture

@skyredwang: TCPDF doesn't have problems with your "image filenames with spaces" as dompdf did, but I do think it has a problem with single quotes.. I will try to commit something soon that will fix that. I'll notify you here when I do.

@boabjohn: your problem is the same as reported in #420460: problem with images with a numerical query. I really do need to know from where that numerical query is coming from.. Can you please provide any answers to that in the proper issue?

João

jcnventura’s picture

Status: Active » Closed (won't fix)

Actually, after developing the fix, I decided that I really shouldn't be trying to fix problems with TCPDF inside the module (Pandora's box and all...)..

Please create an issue for the problem of single quotes in image filenames in TCPDF's issue queue. TCPDF's maintainer is usually fast in fixing things on his side.

João

skyredwang’s picture

skyredwang’s picture

Status: Closed (won't fix) » Active

I have this conversation with the developer; he suggested it's a problem of implementation. https://sourceforge.net/tracker/?func=detail&atid=710532&aid=2765894&gro...

skyred :I was instructed to report an issue here about problem of single quotes in image filenames. details at http://drupal.org/node/429054

you can see the error here http://greatbrewers.com/list/47413

Nicola Asuni (nicolaasuni):I'm unable to reproduce the problem.
You are probably using an old TCPDF version, please upgrade.

I've created a file name with both spaces and quotes and the following
examples are working fine:

$pdf->Image('../images/image demo\'s.jpg', 50, 50, 100, 150, '',
'http://www.tcpdf.org', '', true, 150);
$pdf->writeHTML('Only local images are allowed. height="150" />', 1);
$pdf->writeHTML('Only local images are allowed. height="150" />', 1)

skyred:I updated TCPDF to the april.15 version. The problem remains.
http://greatbrewers.com/list/47413

Nicola Asuni (nicolaasuni):As you can see from the test I've used, TCPDF is working fine.
You probably have a problem on TCPDF implementation.

skyredwang’s picture

I thought TCPDF expected the implementation layer to escape the single quotes in the image filename.

jcnventura’s picture

That's what the fix I did was doing.. It worked, but the problem is that if I start fixing everything that TCPDF can't handle I will end up with a lot of code in the module side which will eventually be obsoleted once TCPDF starts to handle it. This is a bug with TCPDF and has to be fixed by TCPDF.

I will try to come up with an example which doesn't involve Drupal so that Nicola can see that the problem is his code and not the 'TCPDF implementation'. Until then, sorry but you're between a rock and a hard place.. The easiest solution for you is to stop using single quotes in your filenames.

Anyway, this will all become moot once I test and merge #419296: Use wkhtmltopdf for PDF generation. I am pretty sure that everyone will kiss TCPDF and dompdf goodbye at that point.

João

skyredwang’s picture

wkhtmltopdf for PDF generation sounds really exciting

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

I have upgraded to TCPDF 4.5.0043 yesterday and the problem of the single quotes is fixed in that version. Something that Nicola did between 4.5.0032 and 4.5.0043 solved it (possibly this fix on 0036: All tag attributes, such as p align="center" must be enclosed within double quotes.).

So, Nicola was right on that bug report in Sourceforge, there's nothing to be done on his side.

Have you tried with TCPDF 4.5.0043 or later? Is it still giving you problems?

João

skyredwang’s picture

Status: Postponed (maintainer needs more info) » Active

I upgraded TCPDF to

Name: TCPDF
Version: 4.6.001
Release date: 2009-04-17

But the problem remains. Take a closer look at the error

TCPDF ERROR: [Image] No such file or directory in /home/greatbre/public_html/sites/default/files/images/Product%20-%20Founders%20Red's%20Rye.thumbnail.jpg

the single quote in the file name wasn't escaped like \'

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Indeed, you're right.. When I tried to reproduce the problem, what happened to me was the reported missing filename was truncated at the single quote. In your case that's clearly not the problem.

The bad part is that I don't know where to look for in trying to reproduce it.. Have you tried removing the quote in the filename? It would be nice to know if the problem is still related to the quote or if it has nothing to do with it.

João

skyredwang’s picture

Status: Postponed (maintainer needs more info) » Active

Confirm: after removing the quote in the filename, TCPDF works.

jcnventura’s picture

Title: TCPDF problem with Image » TCPDF problem with Image containing single quote
Status: Active » Postponed (maintainer needs more info)

At least something is the problem... I don't have time now to search our history of issues... Can you tell me if you're using the public or the private filesystem method?

I did test both types in my earlier testing, but it would speed up the problem somewhat if I could limit myself to a single one.

João

skyredwang’s picture

Status: Postponed (maintainer needs more info) » Active

I am using public filesystem method. Please feel free to let me know if you need anything.

jcnventura’s picture

There is indeed one thing you could do... I think I need to try a PDF of your page, and not my (simpler) pages to try to find out what the problem is.. Can you please enable the printer-friendly version for anonymous users so that I can access it? I will try to access http://greatbrewers.com/list/47413.

If you need to, please delete/comment out the build_mode = NODE_BUILD_PRINT line.

João

skyredwang’s picture

I am really sorry that I forgot the permission again.

http://greatbrewers.com/list/47413 is working now, because I got rid of the single quote in the filename.

http://greatbrewers.com/list/47708 is another broken one.

jcnventura’s picture

Status: Active » Fixed

Thanks for the URL. I tracked the problem down to something in Drupal replacing the ' in the filenames with &# 039;. I have added some code to decode that into normal characters so that TCPDF understands it.

João

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.