Opened 18 years ago
Closed 12 years ago
#1056 closed defect (wontfix)
Image support
Reported by: | anonymous | Owned by: | Alec Thomas |
---|---|---|---|
Priority: | high | Component: | PageToPdfPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.10 |
Description
It doesn't seem to support embedded images in the PDF using the builtin [Image] macro.
This would be a killer feature for pages which include images as part of the documentation.
Attachments (1)
Change History (19)
comment:1 Changed 18 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 follow-up: 3 Changed 18 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
So ... it doesn't work for me. I have been messing with it for about a day and I can't see what I might be doing wrong.
Is there a certain Image macro parameters or image types that it works with?
I'm running Trac 0.10.3.1 on a Debian server with what I think is the HEAD for the PageToPdf plugin. The HTMLDOC version is 1.8.23.
Any ideas?
comment:3 follow-up: 5 Changed 18 years ago by
Replying to mcaisse:
So ... it doesn't work for me. I have been messing with it for about a day and I can't see what I might be doing wrong.
Is there a certain Image macro parameters or image types that it works with?
I'm running Trac 0.10.3.1 on a Debian server with what I think is the HEAD for the PageToPdf plugin. The HTMLDOC version is 1.8.23.
Any ideas?
I had the same problem. Hav a look in your log file:
Trac[main] WARNING: 403 Forbidden (WIKI_VIEW privileges are required to perform this operation)
I granted WIKI_VIEW to user anonymous. Now it works. But how we can fix this problem? Acctually, I am logged in with a valid user!
comment:4 Changed 18 years ago by
HTMLDOC (the program which converts the HTML to a PDF) is making the image requests, so it has no credentials. There is no way around this that I can think of.
comment:5 follow-up: 6 Changed 18 years ago by
Replying to sier@pm3.ch:
Replying to mcaisse:
So ... it doesn't work for me. I have been messing with it for about a day and I can't see what I might be doing wrong.
Is there a certain Image macro parameters or image types that it works with?
I'm running Trac 0.10.3.1 on a Debian server with what I think is the HEAD for the PageToPdf plugin. The HTMLDOC version is 1.8.23.
Any ideas?
I had the same problem. Hav a look in your log file:
Trac[main] WARNING: 403 Forbidden (WIKI_VIEW privileges are required to perform this operation)I granted WIKI_VIEW to user anonymous. Now it works. But how we can fix this problem? Acctually, I am logged in with a valid user!
Hi, you wrote that you granted WIKI_VIEW to anonymous and it worked – but for me it did not work. Did I miss something?
comment:6 follow-up: 7 Changed 18 years ago by
Replying to rolf.henrich@gmx.net:
Hi, you wrote that you granted WIKI_VIEW to anonymous and it worked – but for me it did not work. Did I miss something?
I'am using
- trac 10.3.1
- htmldoc 1.9-current
- python 2.4.1
Any warnings/errors in your log files?
comment:7 follow-up: 8 Changed 18 years ago by
Replying to anonymous:
Replying to rolf.henrich@gmx.net:
Hi, you wrote that you granted WIKI_VIEW to anonymous and it worked – but for me it did not work. Did I miss something?
I'am using
- trac 10.3.1
- htmldoc 1.9-current
- python 2.4.1
We are using: Trac 0.10.3.1, htmldoc 1.8.27 und Python 2.4.4.
2007-03-21 13:56:58,636 Trac[init] WARNING: 403 Forbidden (FILE_VIEW privileges are required to perform this operation)
Any warnings/errors in your log files?
comment:8 follow-up: 9 Changed 18 years ago by
Replying to anonymous:
2007-03-21 13:56:58,636 Trac[init] WARNING: 403 Forbidden (FILE_VIEW privileges are required to perform this operation)
Seems that you are refering images(files) from the repository. You should enable FILE_VIEW for anonymous users. The problem with htmldoc is that it grabs images(files) always as anonymous user.
comment:9 follow-up: 10 Changed 18 years ago by
Replying to anonymous:
Replying to anonymous:
2007-03-21 13:56:58,636 Trac[init] WARNING: 403 Forbidden (FILE_VIEW privileges are required to perform this operation)
Seems that you are refering images(files) from the repository. You should enable FILE_VIEW for anonymous users. The problem with htmldoc is that it grabs images(files) always as anonymous user.
Perfect! Now it works!!! Thanx for help. It is not a security problem now, is it?
comment:10 Changed 18 years ago by
Replying to anonymous:
Perfect! Now it works!!! Thanx for help. It is not a security problem now, is it?
No, if you intend to share the hole subversion repostory with anyone. People can see the content of your repository.
comment:11 Changed 18 years ago by
Priority: | normal → high |
---|
I have the problem, and anonymous can see everything. I think a wrong path is getting fed to htmldoc. Here's my page URL:
http://localhost:8080/Projects/Community/wiki/FortressQuestions
Here's the wiki reference within that page (it's an attachment):
[[Image(NAS-CG.png, 40%)]][[BR]]
I tweaked the plugin to not delete the file, so I could see what it was generating:
grep img /tmp/tmpXjtHXntracpdf <a style="padding:0; border:none" href="/Projects/Community/attachment/wiki/FortressQuestions/NAS-CG.png"><img width="40%" alt="Nicely rendered version of NAS CG" src="/Projects/Community/attachment/wiki/FortressQuestions/NAS-CG.png?format=raw" title="Nicely rendered version of NAS CG" /></a><br />
as near as I can tell, htmldoc is not talking to any web server, only to files, and any path beginning "/Projects" will only work if fed to the web server. I have this nasty suspicion that Apache knows about the virtualness of "/Projects", but it is keeping it a secret. Here's the relevant hunk of httpd.conf:
Alias /trachtdocs/ "/opt/local/share/trac/htdocs/" <Location /Projects> SetHandler mod_python # Next line fixes funny crashes, in the-o-ry PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracUriRoot "/Projects" PythonOption TracEnvParentDir "/export/home/dc12360/Nobody/Trac" SetEnv PYTHON_EGG_CACHE "/export/home/dc12360/Nobody/EggCache" </Location>
(Actually, that PythonOption looks promising.)
I'd like to use this plugin, but so far, it is not working for me.
comment:12 follow-up: 13 Changed 18 years ago by
D'oh! Previous analysis is wacked. Here's a hack fix. alt, width, etc, between "img" and "src" cause the RE to fail.
# This doesn't work because of alt, width, etc. # page = re.sub('<img src="(?!\w+://)', '<img src="%s://%s:%d' % (req.scheme, req.server_name, req.server_port), page) page = re.sub(' src="(?!\w+://)', ' src="%s://%s:%d' % (req.scheme, req.server_name, req.server_port), page)
comment:13 Changed 17 years ago by
Replying to dr2chase:
D'oh! Previous analysis is wacked. Here's a hack fix. alt, width, etc, between "img" and "src" cause the RE to fail.
# This doesn't work because of alt, width, etc. # page = re.sub('<img src="(?!\w+://)', '<img src="%s://%s:%d' % (req.scheme, req.server_name, req.server_port), page) page = re.sub(' src="(?!\w+://)', ' src="%s://%s:%d' % (req.scheme, req.server_name, req.server_port), page)
That worked to me too, I'll attach a patch so it can be incorporated easily to repository. Regards
comment:14 Changed 17 years ago by
And why aren't those image url's rewritten to local filesystem path? The plugin is running under the same user trac is so it has access directly to the trac env, no need to use http url. I did it like this
page = re.sub('src="(?!\w+://).*/attachment(/[^?"]+)[^"]*', 'src="%s\\1' % (os.path.join(self.env.path, 'attachments')), page)
This way you don't have to enable (FILE_VIEW|WIKI_VIEW) for anonymous users and the images are fetched directly from trac env, htmldoc is not bothering trac to get them.
comment:15 Changed 17 years ago by
i just tried the patch above and i still can't images included via or graphviz.
also, i turned on debug level logging and didn't see any relevant errors or warnings:
2008-04-29 11:28:18,131 Trac[ttadmin] INFO: get_admin_pages 2008-04-29 11:28:18,161 Trac[pagetopdf] DEBUG: HTML output for PageToPDF in charset iso-8859-1 2008-04-29 11:28:18,163 Trac[api] DEBUG: Updating wiki page index 2008-04-29 11:28:18,214 Trac[formatter] DEBUG: Executing Wiki macro graphviz by provider <graphviz.graphviz.Graphviz object at 0xb55919ec> 2008-04-29 11:28:18,225 Trac[formatter] DEBUG: Executing Wiki macro graphviz by provider <graphviz.graphviz.Graphviz object at 0xb55919ec> 2008-04-29 11:28:18,236 Trac[formatter] DEBUG: Executing Wiki macro RecentChanges by provider <trac.wiki.macros.RecentChangesMacro object at 0xb54f11ac> 2008-04-29 11:28:18,263 Trac[pagetopdf] DEBUG: --right 1.5cm --bottom 1.5cm --webpage --top 1.5cm --format pdf14 --size Letter --charset iso-8859-1 --left 1.5cm
i'm running trac 0.10.4
comment:16 Changed 16 years ago by
I've just spent about 2 hours scouring google for hints on why this is failing. Even the latest subversion of pagetopdf doesn't resolve this issue. The main issue is for people like myself that cannot enable anonymous FILE_VIEW and WIKI_VIEW. We've put it behind apache SSL with a self-signed cert, or use a client certification and user authentication. The image src can't be rendered via http/https, it must access the local filesystem.
comment:18 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Works here.