สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
Moderators: mindphp, ผู้ดูแลกระดาน
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27089
- Joined: 22/09/2008 6:18 pm
- Contact:
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
- Posts: 480
- Joined: 25/01/2010 11:57 pm
- Contact:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ผมเรียกใช้ xpdf ผ่าน php ไม่ได้ครับ มันไม่ขึ้นอะไรเลย ลองหมดแล้วครับ
Code: Select all
<?php
$filename = "0405601501.pdf";
$content = exec('./xpdf/pdftotext '.$filename.'');
echo $content;
?>
Code: Select all
<?php
$filename = "0405601501.pdf";
$content = exec('C:\\xpdf\\pdftotext '.$filename.'');
echo $content;
?>
Code: Select all
<?php
$filename = "0405601501.pdf";
$content = exec('C:\Appserv\pdftotextphp\xpdf\pdftotext '.$filename.'');
echo $content;
?>
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27089
- Joined: 22/09/2008 6:18 pm
- Contact:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ใช้ window อะไรครับ
ลองใช้ path เต็ม ของ โปรแกรม xpdf มาใส่
ตามตัวอย่าง
ลองใช้ path เต็ม ของ โปรแกรม xpdf มาใส่
ตามตัวอย่าง
Code: Select all
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
- Posts: 480
- Joined: 25/01/2010 11:57 pm
- Contact:
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
Code: Select all
<?php
$filename = "0405601501.pdf";
$content = exec('C:\Program Files\xpdf>pdftotext '.$filename.'');
echo $content;
?>
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27089
- Joined: 22/09/2008 6:18 pm
- Contact:
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.)
Code: Select all
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
- Posts: 480
- Joined: 25/01/2010 11:57 pm
- Contact:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ก็ถูกนะครับ ลองรันกับ cmd ของ window ก็ใช้ได้นะครับ
-
- PHP Super Member
- Posts: 480
- Joined: 25/01/2010 11:57 pm
- Contact:
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27089
- Joined: 22/09/2008 6:18 pm
- Contact:
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
-
- Similar Topics
- Replies
- Views
- Last post
-
-
แปลง code html เป็น image แต่ไม่แสดงผลลัพธ์
by bankjittapol » 12/11/2019 4:44 pm » in JavaScript & Jquery Ajax - 4 Replies
- 1224 Views
-
Last post by mindphp
13/11/2019 5:29 am
-
-
-
อยากทราบวิธีการ แปลง ไฟล์ html มาเป็น pdf
by Ittichai_chupol » 18/05/2020 12:26 pm » in Programming - PHP - 2 Replies
- 300 Views
-
Last post by Ittichai_chupol
20/05/2020 1:39 pm
-
-
-
การใช้ Domvas library แปลง code html แปลงหน้าเว็บ เป็นรูปภาพ
by bankjittapol » 12/11/2019 6:43 pm » in Jquery & Ajax Knowledge - 0 Replies
- 327 Views
-
Last post by bankjittapol
12/11/2019 6:43 pm
-
-
- 3 Replies
- 1793 Views
-
Last post by buay
15/07/2014 3:42 pm
-
- 0 Replies
- 695 Views
-
Last post by bolue
22/08/2020 6:40 pm
-
-
javascript แปลง string เป็น number จุดทศนิยม 2 ตำแหน่ง
by jataz2 » 23/01/2019 5:56 pm » in AJAX Javascript Library - jQuery - 0 Replies
- 7648 Views
-
Last post by jataz2
23/01/2019 5:56 pm
-
Who is online
Users browsing this forum: No registered users and 5 guests