Re: [Fwd: Re: [PHP-DB] phptotext]]
Yui Hiroaki 写道: Thank you for your quick reply. I succesfully get text from pdf. But this text include error messages. I do not want these error messages. How can I ignore these error. I knew it is font problem. Do you know how to retrieve error using pdftotext option? my platform is debian linux. $handle = popen(/usr/bin/pdftotext \$original_tmp\ - -layout 21, 'r'); $fileread = fopen($original_tmp, r); while( ($point = fread($handle, 10 )) !== false) { echo $point; } --the error-- Error: PDF version 1.6 -- xpdf supports version 1.5 (continuing anyway) Error: Bad annotation action Error: Unknown character collection 'Adobe-Japan1' Error: Unknown font tag 'C0_0' Error (185908): No font in show Error: Unknown font tag 'C0_0' Error (197322): No font in show Error: Unknown font tag 'C0_0' Error: Unknown font tag 'C0_0' Regards, Yui Micah Stevens wrote: Well, of course, this assumes that your pdftotext program is located at /usr/bin/. You're getting some error, and stderr is not being shown using this. Change the line to this: $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout 21, 'r'); That 'should' redirect stderr to the fread statement. -Micah On Sunday 18 September 2005 5:35 am, Yui Hiroaki wrote: Thank you for your quick reply. So I try to rewrite code again below; $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout ,'r'); $read = fread($handle, 2048000); echo $read; pclose($handle); But I can not see anything!! Please do help me! Yui Micah Stevens wrote: Just read the command docs, and you'll come up with something like this: $handle = popen(/usr/bin/pdftotext \uploads/$filename\ - -layout , 'r'); $read = fread($handle, 2048000); pclose($handle); $read = text content of pdf. -Micah On Saturday 17 September 2005 6:29 am, Yui Hiroaki wrote: I would like to retrieve text from pdf. So I try to comand pdftotext at xpdf command. How can I write code? ex; ?php $original_tmp = $_FILES['UploadedFile']['tmp_name']; $original_name = $_FILES['UploadedFile']['name']; $fileHandle = fopen($original_tmp, r); $uu=exec('pdftotext $original_name');//or system('pdftotext $original_name'); ? form method=post action=document.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=512000 input type=file name=UploadedFile style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:100px; br input type=submit value=upload style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:130px; ok -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] phptotext]
if there is only English word inside pdf, I can retrieve text from pdf, but there are involved Japanese text inside pdf, I got error and can not retrieve any text from pdf. I would like to retrieve text from pdf. It is not necessarey to retrieve Japanese text. code--- $handle = popen(/usr/bin/pdftotext \$original_tmp\ - -layout 21, 'r'); $strbuf = fread($handle, 2048000); echo $strbuf;// showing error message Error: $strbuf = addslashes($strbuf); pclose($handle); $sql_insert = INSERT INTO view(b_col,file_name,file_size,file_type,file_date,vtext) VALUES ('$binaryContent','$original_name','$original_size','$original_type',CURTIME(),'$strbuf'); Vicente wrote: Yui wrote: $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout ,'r'); $read = fread($handle, 2048000); echo $read; pclose($handle); But I can not see anything!! Please do help me! $tmpfile = '/home/domain/public_html/pdf_files/myfile.pdf'; chmod ($tmpfile, 0777); $salida = shell_exec(pdftotext /home/domain/public_html/pdf_files/$tmpfile 21); Here we assume pdftotext.exe is inside /home/domain/public_html/pdf_files/ Maybe you have this inside /usr/bin... etc. In this case be aware of the security restrictions in your server when you try to execute a program outside your secure environment. If you have these problems then you can put the executable in the same file's folder. No fear. It works. Also, you can translate the pdftotext error codes or messages to japanese ^_^ if (ereg('some words in the console answer', $salida)) { print 'my message in jp'; } etc.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP-DB] phptotext]]
Thank you for your quick reply. I succesfully get text from pdf. But this text include error messages. I do not want these error messages. How can I ignore these error. I knew it is font problem. Do you know how to retrieve error using pdftotext option? my platform is debian linux. $handle = popen(/usr/bin/pdftotext \$original_tmp\ - -layout 21, 'r'); $fileread = fopen($original_tmp, r); while( ($point = fread($handle, 10 )) !== false) { echo $point; } --the error-- Error: PDF version 1.6 -- xpdf supports version 1.5 (continuing anyway) Error: Bad annotation action Error: Unknown character collection 'Adobe-Japan1' Error: Unknown font tag 'C0_0' Error (185908): No font in show Error: Unknown font tag 'C0_0' Error (197322): No font in show Error: Unknown font tag 'C0_0' Error: Unknown font tag 'C0_0' Regards, Yui Micah Stevens wrote: Well, of course, this assumes that your pdftotext program is located at /usr/bin/. You're getting some error, and stderr is not being shown using this. Change the line to this: $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout 21, 'r'); That 'should' redirect stderr to the fread statement. -Micah On Sunday 18 September 2005 5:35 am, Yui Hiroaki wrote: Thank you for your quick reply. So I try to rewrite code again below; $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout ,'r'); $read = fread($handle, 2048000); echo $read; pclose($handle); But I can not see anything!! Please do help me! Yui Micah Stevens wrote: Just read the command docs, and you'll come up with something like this: $handle = popen(/usr/bin/pdftotext \uploads/$filename\ - -layout , 'r'); $read = fread($handle, 2048000); pclose($handle); $read = text content of pdf. -Micah On Saturday 17 September 2005 6:29 am, Yui Hiroaki wrote: I would like to retrieve text from pdf. So I try to comand pdftotext at xpdf command. How can I write code? ex; ?php $original_tmp = $_FILES['UploadedFile']['tmp_name']; $original_name = $_FILES['UploadedFile']['name']; $fileHandle = fopen($original_tmp, r); $uu=exec('pdftotext $original_name');//or system('pdftotext $original_name'); ? form method=post action=document.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=512000 input type=file name=UploadedFile style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:100px; br input type=submit value=upload style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:130px; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP-DB] phptotext]
Yui wrote: $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout ,'r'); $read = fread($handle, 2048000); echo $read; pclose($handle); But I can not see anything!! Please do help me! $tmpfile = '/home/domain/public_html/pdf_files/myfile.pdf'; chmod ($tmpfile, 0777); $salida = shell_exec(pdftotext /home/domain/public_html/pdf_files/$tmpfile 21); Here we assume pdftotext.exe is inside /home/domain/public_html/pdf_files/ Maybe you have this inside /usr/bin... etc. In this case be aware of the security restrictions in your server when you try to execute a program outside your secure environment. If you have these problems then you can put the executable in the same file's folder. No fear. It works. Also, you can translate the pdftotext error codes or messages to japanese ^_^ if (ereg('some words in the console answer', $salida)) { print 'my message in jp'; } etc.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] phptotext]
Thank you for your quick reply. So I try to rewrite code again below; $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout ,'r'); $read = fread($handle, 2048000); echo $read; pclose($handle); But I can not see anything!! Please do help me! Yui Micah Stevens wrote: Just read the command docs, and you'll come up with something like this: $handle = popen(/usr/bin/pdftotext \uploads/$filename\ - -layout , 'r'); $read = fread($handle, 2048000); pclose($handle); $read = text content of pdf. -Micah On Saturday 17 September 2005 6:29 am, Yui Hiroaki wrote: I would like to retrieve text from pdf. So I try to comand pdftotext at xpdf command. How can I write code? ex; ?php $original_tmp = $_FILES['UploadedFile']['tmp_name']; $original_name = $_FILES['UploadedFile']['name']; $fileHandle = fopen($original_tmp, r); $uu=exec('pdftotext $original_name');//or system('pdftotext $original_name'); ? form method=post action=document.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=512000 input type=file name=UploadedFile style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:100px; br input type=submit value=upload style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:130px; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] phptotext]
Well, of course, this assumes that your pdftotext program is located at /usr/bin/. You're getting some error, and stderr is not being shown using this. Change the line to this: $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout 21, 'r'); That 'should' redirect stderr to the fread statement. -Micah On Sunday 18 September 2005 5:35 am, Yui Hiroaki wrote: Thank you for your quick reply. So I try to rewrite code again below; $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout ,'r'); $read = fread($handle, 2048000); echo $read; pclose($handle); But I can not see anything!! Please do help me! Yui Micah Stevens wrote: Just read the command docs, and you'll come up with something like this: $handle = popen(/usr/bin/pdftotext \uploads/$filename\ - -layout , 'r'); $read = fread($handle, 2048000); pclose($handle); $read = text content of pdf. -Micah On Saturday 17 September 2005 6:29 am, Yui Hiroaki wrote: I would like to retrieve text from pdf. So I try to comand pdftotext at xpdf command. How can I write code? ex; ?php $original_tmp = $_FILES['UploadedFile']['tmp_name']; $original_name = $_FILES['UploadedFile']['name']; $fileHandle = fopen($original_tmp, r); $uu=exec('pdftotext $original_name');//or system('pdftotext $original_name'); ? form method=post action=document.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=512000 input type=file name=UploadedFile style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:100px; br input type=submit value=upload style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:130px; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] phptotext]
Actually, this also assumes you're on a *nix type server. If you're running on windows, you likely won't ever get this to work unless you compile pdftotext using cygwin, and install it that way, which considering your skill level, may be a bit much. Otherwise I'm not sure I know of a windows equivilent. Keep in mind that there's excellent PHP docs on their site, I like them simply because the user comments are usually very helpful. It's obvious you aren't a born english speaker, but your skills should be good enough to get through the php docs. Just go read those. Also google for this stuff, I figure most of my 'darn, how would I do this' problems just be typing into google or A9 the problem.. For example, I just did a search on php pdf to text and 14 million items came up.. granted you'll have to dig through some stuff, but that's part of the job. Sorry to get up on a soap box, it just seems like you're not trying very hard, but I understand that you may be intimidated by language differences. -Micah On Sunday 18 September 2005 9:36 am, Micah Stevens wrote: Well, of course, this assumes that your pdftotext program is located at /usr/bin/. You're getting some error, and stderr is not being shown using this. Change the line to this: $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout 21, 'r'); That 'should' redirect stderr to the fread statement. -Micah On Sunday 18 September 2005 5:35 am, Yui Hiroaki wrote: Thank you for your quick reply. So I try to rewrite code again below; $handle = popen(/usr/bin/pdftotext \$original_name\ - -layout ,'r'); $read = fread($handle, 2048000); echo $read; pclose($handle); But I can not see anything!! Please do help me! Yui Micah Stevens wrote: Just read the command docs, and you'll come up with something like this: $handle = popen(/usr/bin/pdftotext \uploads/$filename\ - -layout , 'r'); $read = fread($handle, 2048000); pclose($handle); $read = text content of pdf. -Micah On Saturday 17 September 2005 6:29 am, Yui Hiroaki wrote: I would like to retrieve text from pdf. So I try to comand pdftotext at xpdf command. How can I write code? ex; ?php $original_tmp = $_FILES['UploadedFile']['tmp_name']; $original_name = $_FILES['UploadedFile']['name']; $fileHandle = fopen($original_tmp, r); $uu=exec('pdftotext $original_name');//or system('pdftotext $original_name'); ? form method=post action=document.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=512000 input type=file name=UploadedFile style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:100px; br input type=submit value=upload style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:130px; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] phptotext
I would like to retrieve text from pdf. So I try to comand pdftotext at xpdf command. How can I write code? ex; ?php $original_tmp = $_FILES['UploadedFile']['tmp_name']; $original_name = $_FILES['UploadedFile']['name']; $fileHandle = fopen($original_tmp, r); $uu=exec('pdftotext $original_name');//or system('pdftotext $original_name'); ? form method=post action=document.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=512000 input type=file name=UploadedFile style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:100px; br input type=submit value=upload style=border: 1px solid; width:200px; height:20px; position:absolute; left:100px; top:130px; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php