Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [plugin] [ORPHAN] wan_pdf
Thanks for the great plug-in…I was hoping something like this would come along.
Feature request: Custom-Fields
I have a site that uses 5+ custom fields in the articles. Is there a way to include that content in the PDF? Even if I have to hardcode the custom-field names into the plug-in.
Thanks Again.
Tom
Offline
#77 2006-03-16 10:09:16
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
I don’t think it is good to include custom-fields, because they are too “custom”. What I want to say is that everyone using custom-fields has another reason for doing this and wants to place the content of the custom-field at another place, eg. user1 wants to place custom-field1 before the exerpt and field2 after the text, user2 wants this vice versa.
But I can post a code snipplet that you can manually insert into the plugin source-code so that erveryone using custom-fields can place it wherever he/she likes. But this requires basic PHP- and HTML-knowledge.
Offline
Re: [plugin] [ORPHAN] wan_pdf
Thanks for the quick reply.
The code snippet for custom-fields would be great!
Thanks again for the great work.
Cheers,
Tom
Offline
#79 2006-03-19 01:07:41
- marios
- Archived Plugin Author

- Registered: 2005-03-12
- Posts: 1,253
Re: [plugin] [ORPHAN] wan_pdf
I had the same error complaining the plugin that it didn’t find a xhtmlpdf in lib.
(Server is Textdrive, so they have php5)
However, removing the tag from an article form and using in an article did work,
I created a test article, with textile on.=worked
I switched textile off,=worked
I inserted an artilce image=worked
I tested once more in an artilce form worked,
BUT: For very complex articles that have lot’s of complex markup with cite, code, strong lists etc,
The link is there but the pdf file is empty,no output.
You can see it here on Mike Purvis article(That’s the second article from top,textile is of course switched off.
(May be, it is because the article has tables inside?)
EDIT..: Non-ASCII does not work,(I have everything in UTF-8 including page encoding)
regards, marios
Last edited by marios (2006-03-19 03:19:43)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#80 2006-03-23 11:40:35
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
Hi marios,
there is currently no table support in xhtml2pdf. But I wonder why the article is empty then.
Do I understand you right, with PHP5 everything (for simple articles) worked if you put the tag directly into the article and not in the article form? Very interesting. I just changed my webhost and the new one has PHP5 enabled so I hope I have some time to check the PHP5 compatibility.
More and more I am confessed, UTF8 is hell (or I am too stupid).
Offline
#81 2006-03-23 20:18:20
- marios
- Archived Plugin Author

- Registered: 2005-03-12
- Posts: 1,253
Re: [plugin] [ORPHAN] wan_pdf
You can see it here . Sroll down to the last article, you will see, there are “two” pdf links.
That’s the only dummy article that allso has a wan tag inside an article, while all the others have the wan tag in an article form.
reg.php5:, that’s what Textdrive Servers run as default AFAIK, mysql4.1.13 and php5,unless you use your own php.ini. (don’t know which version, because running php.info in webmin is not allowed).
Allways, I do everything in UTF-8, so all the page headers reflect that, and the database collation as well.
Now regarding this localization problem.
If I wanted to make this work in UTF-8 for character ranges outside of ASCII/ANSI whatwould be the best
way to go?
Am i right to assume that I have to find or generate the appropraiate font files with the glyps I need ?
(EDIT.: Nelson is down again for a reboot)
regards, mariosLast edited by marios (2006-03-23 23:00:22)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#82 2006-03-24 01:21:48
- marios
- Archived Plugin Author

- Registered: 2005-03-12
- Posts: 1,253
Re: [plugin] [ORPHAN] wan_pdf
I still can not make any sense out of this, but I believe that it is a font issue, so in order to have support for the characters that are outside the ascii range , that you have to add the missing glyps in the php font files, needed unfortunately, in order to do so are some utilities,
that need to be compiled first and AFAIU yeou need Darwin Ports for this.
(The whole concept used though is not a real UNICODE thing anyway, it’s a mapping story that fakes UNICODESupport,)
Anyway , seems overwhelmingly comples to go to make your own font files and mappings,
I whished, they would be available somewhere for download, but it doesn’t seem like that.
But , wanny, really great plugin works great,
regards, marios
Last edited by marios (2006-03-24 01:22:48)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#83 2006-03-24 09:31:03
- wmike
- Member
- Registered: 2006-01-03
- Posts: 44
Re: [plugin] [ORPHAN] wan_pdf
Hi All,
I’ve been trying to get this excellent plugin to work with not luck – I get the following:
tag_error <txp:wan_pdf/> -> Warning: getimagesize(/home/sites/wrightplace.co.uk/public_html/textpattern/lib/xhtml2pdf/images/57.jpg): failed to open stream: No such file or directory on line 215
tag_error <txp:wan_pdf/> -> Warning: getimagesize(/home/sites/wrightplace.co.uk/public_html/textpattern/lib/xhtml2pdf/images/57.jpg): failed to open stream: No such file or directory on line 254
tag_error <txp:wan_pdf/> -> Warning: getimagesize(/home/sites/wrightplace.co.uk/public_html/textpattern/lib/xhtml2pdf/images/57.jpg): failed to open stream: No such file or directory on line 901
tag_error <txp:wan_pdf/> -> Warning: getimagesize(/home/sites/wrightplace.co.uk/public_html/textpattern/lib/xhtml2pdf/images/57.jpg): failed to open stream: No such file or directory on line 1515
FPDF error: Missing or incorrect image file: /home/sites/wrightplace.co.uk/public_html/textpattern/lib/xhtml2pdf/images/57.jpg
Note – textile is on – as far as I can see the directory listed above doesn’t exist ie the’/images’ bit.
Any suggestions, please.
Cheers!
Mike
Offline
#84 2006-03-24 10:10:05
- wmike
- Member
- Registered: 2006-01-03
- Posts: 44
Re: [plugin] [ORPHAN] wan_pdf
Hi,
Further to last.
Tried with just a text article – opens a pdf with just the first paragraph – the rest of the article is missing.
The image problem remains.
So:
1. whole article does not get to pdf
2. images break it!
Cheers!
Mike
Offline
Re: [plugin] [ORPHAN] wan_pdf
Hi Wanni,
Just wanted to check back with you about the code snippet for including custom-fields. I think I’ve got everything else working perfectly. This plug-in could really change our whole work flow…Thanks again for the great work.
Cheers,
Tom
Offline
#86 2006-03-28 22:28:32
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
Hi Tom (and the others of course),
I just forgot the custom field thing and all that, I have to submit my diploma thesis tomorrow, so I ran out of time the last days. Sorry for that, but I will post the snipplet tomorrow (I’ll promise).
Cheers,
Martin
Offline
Re: [plugin] [ORPHAN] wan_pdf
Martin,
Yikes! Diploma Thesis.
No worries at all…take your time…best of luck.
Cheers,
Tom
Offline
#88 2006-04-02 10:18:20
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
@wmike: I think, you don’t produce valid XHTML, so try to enter debug-mode, take the temporary html-file and put it into the validator .
@renobird: So here is the solution with the custom fields:
Go into the plugin source code and search for
<code>// change image-urls to http://… </code>
<code>$excerpt = str_replace(‘<img src=”/textpattern’, ‘<img src=“http://’.$prefs[‘siteurl’], $excerpt);</code>
<code>$body = str_replace(‘<img src=”/textpattern’, ‘<img src=“http://’.$prefs[‘siteurl’], $body);</code>
and after that you plug in
<code>$c_field1 = safe_field(‘custom_1’,‘textpattern’,‘id = ‘.$thisarticle[‘thisid’]);</code>
Of course you have to replace “custom_1” with the number of the custom field you want to insert. And I also recommend to change the name of the variable regarding to the custom field.
So we got our custom field, we only have to put it into the template. Some lines below you find
<code>fwrite($file, $xhtml_header.”<h1>”.$title.”</h1>\n”.$excerpt.$body.”</body></html>”);</code>
Change this line to put the content of the custom field where you like. Just a little example: In custom field 1 you store the name of the author manually and you want to put this information below the headline, you have to replace this line with
<code>fwrite($file, $xhtml_header.”<h1>”.$title.”</h1>\n”.”<p>Author: “.$c_field1.”</p>\n”.$excerpt.$body.”</body></html>”);</code>
I hope, this will help you.
Last edited by wanni (2006-04-02 10:30:32)
Offline
#89 2006-04-02 14:31:01
- wmike
- Member
- Registered: 2006-01-03
- Posts: 44
Re: [plugin] [ORPHAN] wan_pdf
Hi,
I do create valid code – I take great care to do so & validate all my pages before uploading them – the plugin seems to be pointing to directories that do not exist.
Note. Textpattern renames all images so that they follow a nubered sequence – ie 2.jpg, 3.jpg etc – I don’t know if this is relevant.
Cheers!
Mike
Offline
Re: [plugin] [ORPHAN] wan_pdf
Wanni,
Many, Many Thanks! I’m going to give it a go now.
I’ll send you a link once the site is completed…so you can see all your hard work in action. : )
Cheers Mate.
—
Tom
Offline