By: Amok
Date: 2014-12-22
Time: 15:59
|
Newbie problemsHi there!
I'm trying to use OpenTBS in order to populate a Libre Office .odt file from an html form. Oddly enough, I cannot make it work properly. I took a look of the demo .php and template, but it just doesn't seem to work for me. The problem is, the generated .odt contains nothing but funny characters that I assume to be the representation of a binary file. Funny enough, if I echoed some of the variables retrieved with $_POST from the form, the generated .odt show them perfectly. My experience programming is quite limited, so please be patient. That's how my code looks like:
Note that i don't even tried to merge any data (save for the accidental echo issue). |
||
By: Skrol29
Date: 2014-12-23
Time: 01:41
|
Re: Newbie problemsHi Amok,
This may happen if your PHP script send some content before the end of the merging. It can be one of your echo() command, or maybe a PHP notice. I suggest that use use the OpenTBS debug mode. See http://www.tinybutstrong.com/opentbs.php?doc#debugmode |
||
By: Amok
Date: 2014-12-23
Time: 09:45
|
Re: Newbie problemsOk, thnaks a lot. I will try that.
But I have another silly doubt: is it required to have Open Office or Libre Office installed on server side? |
||
By: Skrol29
Date: 2014-12-23
Time: 10:39
|
Re: Newbie problems> is it required to have Open Office or Libre Office installed on server side?
Not at all. OpenTBS works only by extracting XML from the documents, modify them, and put them back in the document. |
||
By: Amok
Date: 2014-12-23
Time: 13:27
|
Re: Newbie problemsThe Debug output looks like this:
All seems to be ok, despite the typical php encoding issue, and the fact that there are no line breaks (I formatted the output myself a bit in order to post it here). The [onload] fields are correctly merged. Anyway, the 'save as' dialog doesn't appears (surprisingly, in my personal laptop that dialog DO appears, so maybe it is related to some PHP config file), and the TBS->Show just prints the same bucket of random characters. |
||
By: Skrol29
Date: 2014-12-24
Time: 01:32
|
Re: Newbie problemsOk.
You have also to check if your PHP script is a UTF-8 encoded, not ANSI. Also check that your script is actually ending after the $TBS->Show() command. You can add an exit() in order to ensure the script is ending. If the problem is not gone, then you have to open the result ODT file with a text editor or hexa editor and whatch the star and the ending to see if there is some XML or HTML contents. If the problem is not gone, you can send you ODT result to me. |
||
By: Amok
Date: 2015-02-17
Time: 09:41
|
Re: Newbie problemsI've solved the encoding issue (it was a silly mistake by me, as I was not using the php header() function in the very first line of the .php files to enforce UTF-8). Anyway, OpenTBS still doesn't work. I'll send you my .odt file as soon as I can.
Thank you very much. |
||
By: Amok
Date: 2015-03-06
Time: 09:51
|
Re: Newbie problemsProblems solved, thanks to Skrol29.
Be careful of keeping the brackets and the text inside [onload.whatever] in the same format (font, etc). That was my mistake. Also, on TBS->Show() calling, you cannot use a string to pass the show mode parameter. See:
This code above won't work at all. You need to pass the $showmode parameter not as an string, and directly the function call:
Now it works. That was a major flaw in my code... |
||
By: Skrol29
Date: 2015-03-06
Time: 16:39
|
Re: Newbie problemsOK, thanks for this feed back.
|