I am having trouble exporting PDFs now. Basically the pdf is exported with no formatting or logo.
I have a test and a production server. Both at the same SVN rev 2969 and zend 22148. Apache error logs show the following:
[Mon May 10 17:12:35 2010] [error] [client 192.168.10.1] Cannot open , referer: http://localhost:2224/index.php?module=invoices&view=manage
[Mon May 10 17:12:35 2010] [error] [client 192.168.10.1] Cannot connect to localhost:2224 - (111) Connection refused, referer: http://localhost:2224/index.php?module=invoices&view=manage
[Mon May 10 17:12:35 2010] [error] [client 192.168.10.1] Cannot open http://localhost:2224//templates/invoices/default/style.css, referer: http://localhost:2224/index.php?module=invoices&view=manage
[Mon May 10 17:12:35 2010] [error] [client 192.168.10.1] Cannot connect to localhost:2224 - (111) Connection refused, referer: http://localhost:2224/index.php?module=invoices&view=manage
[Mon May 10 17:12:35 2010] [error] [client 192.168.10.1] Cannot open http://localhost:2224//templates/invoices/logos/logo.jpg, referer: http://localhost:2224/index.php?module=invoices&view=manage
So that looks about right, no css and no logo. I do get these kinds errors on the test server but they don't seem to bother anything:
[Mon May 10 17:12:35 2010] [error] [client 192.168.10.1] Cannot open , referer: http://localhost:2224/index.php?module=invoices&view=manage
The thing is I am not having any of the css/logo related errors on my test server. The only difference between the two is:
1. Data
2. The production server is being accessed via ssh tunnel
If you look at the paths in the css/logo errors, they have a "//templates/invoices" after the hostname, note the double slash. I am not certain if this is the issue because I can cut and paste that address (with the double slash) and can get a display of that logo or css file without issue.
Not sure where to look on fixing this.
I found a related issue:
http://simpleinvoices.org/forum/discussion/1211/
I did try to enter the:
echo $siUrl ;
and it gave me my hostname at the top:
http://localhost:2224/
but the invoice list would not load just says processing please wait. Apache is throwing no more errors either.
hey mrembedded
thanks for the siUrl section - you ca remove that bit now
- just make sure you have php-gd installed
refer: http://simpleinvoices.org/wiki/logo_not_displaying_in_the_pdf
let us know how you go
cheers
justin
The php5-gd is installed and enabled just fine according to phpinfo. This problem stems from something else. Justin can you confirm the double slash // in the path is not the root of this issue?
In this case it seems that in a tunneled, nonstandard port or even possibly a natted setup, the export to pdf or email pdf feature may be broken. The export to .doc or .xls is fine and the print preview is also. The apache errors seem to indicate this is an absolute/relative path problem with the pdf module.
Also on my test server that is working. If I tunnel to port 80 of that machine and redirect it to another port on my local machine, the export pdf comes out with no css/logo and the logs show the errors. If I go direct using the hostname/ip there is no issue. So this further points to a absolute path issue.
More info.
1. If I tunnel, forwarding port 80 from my server to port 2225 of my local machine, and connect to my server using http://localhost:2225, the pdf come out with no formatting or logo
2. If I tunnel, forwarding port 80 from my server to port 2225 of my local machine, and connect to my server using http://my-client-ip:2225, the pdf comes out correctly
So it seems that that localhost is special with pdf generation so in my case its a simple work around. I am not sure if this is the same issue on the other thread but this works for me.
thanks for the update!
i should of mentioned that people have reported that using their IP instead of localhost can fix the issue - i've updated the wiki page with details
cheers
justin
Just a thought.
This issue might be permanently resolved if the pdf export routine can be set to use the localhost address or a relative file location path rather than the path in the browser address bar. I tcpdumped the server interface and it tries to talk to the hostname used in the address bar path during the export for the purpose of the actual pdf generation. I don't understand why its done that way but it seems simple enough to correct.
Yes I have a firewall setup where this issue is causing problems. Its my feeling that in order to 'trick' the simple invoices, I may try and play with my hosts file and make my local machine alias the server name on the remote server. That way, in my browser I will type an address of the remote server (behind the firewall) and then that address will actually resolve to my localhost and port. When the pdf export is done, it will take the address from the address bar and then the server should realize that that is ITS address and do everything locally and export the pdf properly. I can do it this way because I am accessing it via ssh tunnel rather than NAT and the port is forwarded to my local machine.
Or
I just wont work that way and the pdf export routine will need some work.
thanks guys
let me know if you've got PDF working now - and what you did
note: we may be adding/switching to a new PDF export library in the near future - may help with this
cheers
justin
With rev 3053, the pdf invoices still come out with no logo or css. This only happens if you are tunneling or in some NAT setups. For example, I don't keep my SI in the public domain so I need to tunnel the www interface over ssh and that causes the pdf export to break
It looks like you're new here. If you want to get involved, click one of these buttons!