สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
Moderator: mindphp, ผู้ดูแลกระดาน
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41417
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ยินดีด้วยครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ผมเรียกใช้ xpdf ผ่าน php ไม่ได้ครับ มันไม่ขึ้นอะไรเลย ลองหมดแล้วครับ
โค้ด: เลือกทั้งหมด
<?php
$filename = "0405601501.pdf";
$content = exec('./xpdf/pdftotext '.$filename.'');
echo $content;
?>
โค้ด: เลือกทั้งหมด
<?php
$filename = "0405601501.pdf";
$content = exec('C:\\xpdf\\pdftotext '.$filename.'');
echo $content;
?>
โค้ด: เลือกทั้งหมด
<?php
$filename = "0405601501.pdf";
$content = exec('C:\Appserv\pdftotextphp\xpdf\pdftotext '.$filename.'');
echo $content;
?>
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41417
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ใช้ window อะไรครับ
ลองใช้ path เต็ม ของ โปรแกรม xpdf มาใส่
ตามตัวอย่าง
ลองใช้ path เต็ม ของ โปรแกรม xpdf มาใส่
ตามตัวอย่าง
โค้ด: เลือกทั้งหมด
exec('C:\Program Files\xpdf>pdftotext parameter')
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ลองทำแล้วปรากฎว่าสามารถรันได้ แต่ได้ไฟล์ว่างเปล่า ที่มีชื่อว่า pdftotext ไม่มีนามสกุล
ผมเก็บไฟล์ไว้ตามนี้ครับ
C:/xpdf
C:/Appserv/pdftotextphp/test.php
C:/Appserv/pdftotextphp/0405601501.pdf
ผมเก็บไฟล์ไว้ตามนี้ครับ
C:/xpdf
C:/Appserv/pdftotextphp/test.php
C:/Appserv/pdftotextphp/0405601501.pdf
โค้ด: เลือกทั้งหมด
<?php
$filename = "0405601501.pdf";
$content = exec('C:\Program Files\xpdf>pdftotext '.$filename.'');
echo $content;
?>
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41417
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
รูปแบบการใช้งาน
OPTIONS
-f number
Specifies the first page to convert.
-l number
Specifies the last page to convert.
-layout
Maintain (as best as possible) the original physical layout of
the text. The default is to 'undo' physical layout (columns,
hyphenation, etc.) and output the text in reading order.
-fixed number
Assume fixed-pitch (or tabular) text, with the specified charac-
ter width (in points). This forces physical layout mode.
-raw Keep the text in content stream order. This is a hack which
often "undoes" column formatting, etc. Use of raw mode is no
longer recommended.
-htmlmeta
Generate a simple HTML file, including the meta information.
This simply wraps the text in <pre> and </pre> and prepends the
meta headers.
-enc encoding-name
Sets the encoding to use for text output. The encoding-name
must be defined with the unicodeMap command (see xpdfrc(5)).
The encoding name is case-sensitive. This defaults to "Latin1"
(which is a built-in encoding). [config file: textEncoding]
-eol unix | dos | mac
Sets the end-of-line convention to use for text output. [config
file: textEOL]
-nopgbrk
Don't insert page breaks (form feed characters) between pages.
[config file: textPageBreaks]
-opw password
Specify the owner password for the PDF file. Providing this
will bypass all security restrictions.
-upw password
Specify the user password for the PDF file.
-q Don't print any messages or errors. [config file: errQuiet]
-cfg config-file
Read config-file in place of ~/.xpdfrc or the system-wide config
file.
-v Print copyright and version information.
-h Print usage information. (-help and --help are equivalent.)
โค้ด: เลือกทั้งหมด
pdftotext [options] [PDF-file [text-file]]
OPTIONS
-f number
Specifies the first page to convert.
-l number
Specifies the last page to convert.
-layout
Maintain (as best as possible) the original physical layout of
the text. The default is to 'undo' physical layout (columns,
hyphenation, etc.) and output the text in reading order.
-fixed number
Assume fixed-pitch (or tabular) text, with the specified charac-
ter width (in points). This forces physical layout mode.
-raw Keep the text in content stream order. This is a hack which
often "undoes" column formatting, etc. Use of raw mode is no
longer recommended.
-htmlmeta
Generate a simple HTML file, including the meta information.
This simply wraps the text in <pre> and </pre> and prepends the
meta headers.
-enc encoding-name
Sets the encoding to use for text output. The encoding-name
must be defined with the unicodeMap command (see xpdfrc(5)).
The encoding name is case-sensitive. This defaults to "Latin1"
(which is a built-in encoding). [config file: textEncoding]
-eol unix | dos | mac
Sets the end-of-line convention to use for text output. [config
file: textEOL]
-nopgbrk
Don't insert page breaks (form feed characters) between pages.
[config file: textPageBreaks]
-opw password
Specify the owner password for the PDF file. Providing this
will bypass all security restrictions.
-upw password
Specify the user password for the PDF file.
-q Don't print any messages or errors. [config file: errQuiet]
-cfg config-file
Read config-file in place of ~/.xpdfrc or the system-wide config
file.
-v Print copyright and version information.
-h Print usage information. (-help and --help are equivalent.)
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ก็ถูกนะครับ ลองรันกับ cmd ของ window ก็ใช้ได้นะครับ
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41417
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ที่ผมเคยทำผมจะ exec() แปลง เป็นไฟล์ text แล้ว php อ่านไฟล์ text มาใช้อีกทีหนึ่ง
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
เรียบร้อยได้แล้วครับ ความพยายามอยู่ที่ไหนความพยายามอยู่ที่นั่น เอ้ยความสำเร็จ
ถ้าเอาไฟล์ pdftotext มาไว้ที่เดี๋ยวกับไฟล์เว้บเราก็เรียกแบบนี้ได้เลย
ขอบคุณมากครับ
โค้ด: เลือกทั้งหมด
<?php
$filename = "541170301.pdf";
$content = exec('C:\AppServ\www\pdftotextphp\pdftotext.exe '.$filename.'');
echo $content;
?>
โค้ด: เลือกทั้งหมด
<?php
$filename = "541170301.pdf";
$content = exec('pdftotext.exe '.$filename.'');
echo $content;
?>
-
- PHP Newbie
- โพสต์: 2
- ลงทะเบียนเมื่อ: 08/06/2017 1:48 pm
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
อันนี้แก้ในไฟล์ไหนหรอครับที่เพิ่ม encoding ลงไปอะครับ
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ อยากทราบวิธีการ แปลง ไฟล์ html มาเป็น pdf
โดย Ittichai_chupol » 18/05/2020 12:26 pm » ใน Programming - PHP - 2 ตอบกลับ
- 1360 แสดง
-
โพสต์ล่าสุด โดย Ittichai_chupol
20/05/2020 1:39 pm
-
-
-
โพสต์ใหม่ แปลง code html เป็น image แต่ไม่แสดงผลลัพธ์
โดย bankjittapol » 12/11/2019 4:44 pm » ใน JavaScript & jQuery Ajax & Node.JS - 4 ตอบกลับ
- 3812 แสดง
-
โพสต์ล่าสุด โดย mindphp
13/11/2019 5:29 am
-
-
-
โพสต์ใหม่ การใช้ Domvas library แปลง code html แปลงหน้าเว็บ เป็นรูปภาพ
โดย bankjittapol » 12/11/2019 6:43 pm » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 1133 แสดง
-
โพสต์ล่าสุด โดย bankjittapol
12/11/2019 6:43 pm
-
-
-
โพสต์ใหม่ การใช้ .text() .html() และ .val() เพื่อเปลี่ยนข้อความ เมื่อกดปุ่ม
โดย bankjittapol » 15/11/2019 2:17 pm » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 1723 แสดง
-
โพสต์ล่าสุด โดย bankjittapol
15/11/2019 2:17 pm
-
-
-
โพสต์ใหม่ การใช้ method text(), html()และ val() ใน jQuery
โดย Parichat » 11/01/2018 11:14 am » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 2457 แสดง
-
โพสต์ล่าสุด โดย Parichat
11/01/2018 11:14 am
-
-
-
โพสต์ใหม่ Tip CSS : Word Breaking (การทำให้ text html element ไม่ล้น)
โดย pprn » 11/07/2018 4:46 pm » ใน CSS Knowledge - 0 ตอบกลับ
- 4376 แสดง
-
โพสต์ล่าสุด โดย pprn
11/07/2018 4:46 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: Google [Bot] และบุคลทั่วไป 113