Display Contents of a doc file in a textarea in php - php

I want display the content of doc file in a textarea for my project using PHP as it is means line break, font size etc.
Any code or how to do it. And i will be fetching that doc file from database.

Have a look at FCKEditor. Let me know if it works

Related

Is that possible to extract doc/docx file page wise in php?

I have a web form where user needs to upload a document file (doc or docx), in that file there is some formatted data on multiple each page. so I want to extract that data but I also need to know page number as well. That means I want content of each page separately, is it possible?
Thanks
Its not in raw format, so you want this maybe to interpret the code of docx.
https://github.com/PHPOffice/PHPWord Check this.

Using JQuery or PHP to pull latest image?

I was trying to figure out a way to have JQuery (if possible) to display the latest image from a directory, regardless of its file name. Basically, I just want a simple tag to be updated to show the image. I realize this might not be possible with Jquery, so my fallback would be PHP.
I've been trying to research how to do this, but honestly do not know where to start. Any tips to get going would be greatly appreciated,
If you want to do it with JQuery, you can! You only need to add a few lines of logic to your app.
For example, when you add images to that folder, also write a text file with the name of the image just added. Then this text file is going to always have the filename of the last image uploaded. Finally, using JavaScript(with JQuery or anything else) you do one request to the text file and then you do the second request to obtain the image with that filename.
That is just a very basic example to try to share the idea of how to do it, then depending your particular case, you can add or change a lot of details to make this works for your case.
BTW, to do it with PHP, you are going to need to execute a system command, for example 'ls -ltrh' and parse the output to obtain the last filename.
You can use PHP script to get latest modified file in a specific directory.
Code can be found here: Get last modified file in a directory
You then can format that into JSON which can be passed through a jQuery AJAX call http://api.jquery.com/jQuery.ajax/
With those 2 techniques, you can manipulate the data to display the image.

Using PHP to read text from a PDF stored in mysql

I am trying to use PHP to read the text from a PDF file that is stored in a mysql database. I tried using class.pdf2text.php, which works with an actual file. I tried to use the MYSQL_RESULT variable with the pdf file contents with that class, but it doesn't work. I've got to be missing something really easy, I just know it.
Basically, this is what I'm trying to do:
I have a database with PDF files. I need to convert a PDF from that database to text and then search on that text for certain data. Is there a way to do this without creating external files in PHP?

Get data from a remote, dynamically created, text file with php

I'm trying to get (with PHP) data from a remote text file. The URL of the file is website.com/page.php?info=someinfo. So it's not a .txt file, I don't know if that matters. The whole contents of the page are text, however. When looking at the source, there is no HTML, only plain text.
I've been trying to get the data using fopen() and fread(), and file_get_contents. However, both methods give me a screen filled with "404, object not found" errors, placed all over the place. Does anyone know how to solve this?
Thanks,
"website.com/page.php?info=someinfo" is not a text file, this is an HTML stream.
If you want to sniff the html content resulting from the query to "website.com/page.php?info=someinfo" then you have to use file_get_contents only, not fread nor fopen.

create an image from table

I have following problem. I have txt file here : http://ch1zra.com/d2/runes.txt
I use PHP to loop throgh the file and generate this table : http://ch1zra.com/d2/runes.php
Table uses some basic styles and I like it that way.
txt file is generated and uploaded via python. I would like to create an image that looks like that table. Is there any way using python or PHP to do so ?
Any image format that is acceptable on the web is good, PNG being even quite welcome.
I've read somewhere that python reportlab can make styled tables with alignments and so on, so that could be a good start, but reportlab generates PDF. Of course, if that is just a step between it is also acceptable (if I could do the PDF > img conversion on my machine). ALso, IIRC every PDF contains a "screenshot" of each page for fast browsing, so that would also be cool.
All in all, I have this txt file and this HTML table that I want as image. If any1 can help that would be great :)
thanx in advance!
I can only speak for PHP.
You could try to build the image by hand with PHP's image functions http://www.php.net/manual/en/book.image.php
Or you could try executing a external script like: http://marginalhacks.com/Hacks/html2jpg/

Categories