สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
Moderator: mindphp, ผู้ดูแลกระดาน
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ใครรู้มั่งครับว่าจะแปลง PDF ไปเป็น text หรือ HTML ยังไง หรือมี Library ตัวให้ให้ใช้งานบ้างครับ ของตัวอย่างการใช้งานด้วยนะครับ ผมจะลองหาดูก่อน รบกวนด้วยครับ
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41232
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ผมเคยทำแต่นานมาแล้ว จำรายละเอียดไม่ค่อยได้ แต่หลักการคือ
ใช้ โปรแกรมพวกที่ แปลง pdf เป็น text หรือ html ได้ติดตั้งบน Server
แล้ว ใช้ php รันคำสั่งระบบเพิ่อไปเรียกโปรแกรมพวกนั้น ทำงาน
แต่ถ้าต้องการแปลง pdf เป็นรูปก็ imagemagick ครับ
ใช้ โปรแกรมพวกที่ แปลง pdf เป็น text หรือ html ได้ติดตั้งบน Server
แล้ว ใช้ php รันคำสั่งระบบเพิ่อไปเรียกโปรแกรมพวกนั้น ทำงาน
แต่ถ้าต้องการแปลง pdf เป็นรูปก็ imagemagick ครับ
ติดตาม 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 แต่งงมากตั้งแต่ขึ้นตอนติดตั้ง ไม่ทราบว่าพอจะทำเป็นหรือป่าวครับ window server ครับ
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41232
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ติดตั้งโปรแกรม เป็นโปรแกรมทั่วๆ ครับ
หรือ อาจแค่ copy ไฟล์ไปวางที่ server แล้วใช้ command เรียกให้มันทำงาน
แล้วก็สั่ง command นั้นด้วย php
หรือ อาจแค่ copy ไฟล์ไปวางที่ server แล้วใช้ command เรียกให้มันทำงาน
แล้วก็สั่ง command นั้นด้วย php
ติดตาม 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
ตอนนี้ใช้งานได้แล้วครับ ใช้ UTF-8 แต่มันอ่านพวกวรรณยุกต์ไม่ออก เลยลองเปลี่ยนเป็น TIS-620
แต่มันขึ้นแจ้งว่า
ลองแก้แล้วแต่มันก็ยังมองไม่เห็น ไม่รู้ต้องเซ็ตอะไรหรือป่าว
โค้ด: เลือกทั้งหมด
textEncoding TIS-620
#----- begin Thai support package (2011-aug-15)
nameToUnicode C:\\Program Files\\xpdf\\thai\Thai.nameToUnicode
unicodeMap TIS-620 C:\\Program Files\\xpdf\\thai\TIS-620.unicodeMap
#----- end Thai support package
โค้ด: เลือกทั้งหมด
C:\Program Files\xpdf>pdftotext -htmlmeta 0405601501.pdf
Config Error: Bad 'nameToUnicode' config file command (C:\Program Files\xpdf\xpdfrc:76)
Config Error: Bad 'unicodeMap' config file command (C:\Program Files\xpdf\xpdfrc:77)
Syntax Error: Couldn't find unicodeMap file for the 'TIS-620' encoding
Config Error: Couldn't get text encoding
โค้ด: เลือกทั้งหมด
#========================================================================
#
# Sample xpdfrc file
#
# The Xpdf tools look for a config file in two places:
# 1. ~/.xpdfrc
# 2. in a system-wide directory, typically /usr/local/etc/xpdfrc
#
# This sample config file demonstrates some of the more common
# configuration options. Everything here is commented out. You
# should edit things (especially the file/directory paths, since
# they'll likely be different on your system), and uncomment whichever
# options you want to use. For complete details on config file syntax
# and available options, please see the xpdfrc(5) man page.
#
# Also, the Xpdf language support packages each include a set of
# options to be added to the xpdfrc file.
#
# http://www.foolabs.com/xpdf/
#
#========================================================================
#----- display fonts
# These map the Base-14 fonts to the Type 1 fonts that ship with
# ghostscript. You'll almost certainly want to use something like
# this, but you'll need to adjust this to point to wherever
# ghostscript is installed on your system. (But if the fonts are
# installed in a "standard" location, xpdf will find them
# automatically.)
#fontFile Times-Roman /usr/local/share/ghostscript/fonts/n021003l.pfb
#fontFile Times-Italic /usr/local/share/ghostscript/fonts/n021023l.pfb
#fontFile Times-Bold /usr/local/share/ghostscript/fonts/n021004l.pfb
#fontFile Times-BoldItalic /usr/local/share/ghostscript/fonts/n021024l.pfb
#fontFile Helvetica /usr/local/share/ghostscript/fonts/n019003l.pfb
#fontFile Helvetica-Oblique /usr/local/share/ghostscript/fonts/n019023l.pfb
#fontFile Helvetica-Bold /usr/local/share/ghostscript/fonts/n019004l.pfb
#fontFile Helvetica-BoldOblique /usr/local/share/ghostscript/fonts/n019024l.pfb
#fontFile Courier /usr/local/share/ghostscript/fonts/n022003l.pfb
#fontFile Courier-Oblique /usr/local/share/ghostscript/fonts/n022023l.pfb
#fontFile Courier-Bold /usr/local/share/ghostscript/fonts/n022004l.pfb
#fontFile Courier-BoldOblique /usr/local/share/ghostscript/fonts/n022024l.pfb
#fontFile Symbol /usr/local/share/ghostscript/fonts/s050000l.pfb
#fontFile ZapfDingbats /usr/local/share/ghostscript/fonts/d050000l.pfb
# If you need to display PDF files that refer to non-embedded fonts,
# you should add one or more fontDir options to point to the
# directories containing the font files. Xpdf will only look at .pfa,
# .pfb, .ttf, and .ttc files in those directories (other files will
# simply be ignored).
#fontDir /usr/local/fonts/bakoma
#----- PostScript output control
# Set the default PostScript file or command.
#psFile "|lpr -Pmyprinter"
# Set the default PostScript paper size -- this can be letter, legal,
# A4, or A3. You can also specify a paper size as width and height
# (in points).
#psPaperSize letter
#----- text output control
# Choose a text encoding for copy-and-paste and for pdftotext output.
# The Latin1, ASCII7, and UTF-8 encodings are built into Xpdf. Other
# encodings are available in the language support packages.
textEncoding TIS-620
#----- begin Thai support package (2011-aug-15)
nameToUnicode C:\\Program Files\\xpdf\\thai\Thai.nameToUnicode
unicodeMap TIS-620 C:\\Program Files\\xpdf\\thai\TIS-620.unicodeMap
#----- end Thai support package
# Choose the end-of-line convention for multi-line copy-and-past and
# for pdftotext output. The available options are unix, mac, and dos.
#textEOL unix
#----- misc settings
# Enable t1lib, FreeType, and anti-aliased text.
#enableT1lib yes
#enableFreeType yes
#antialias yes
# Set the command used to run a web browser when a URL hyperlink is
# clicked.
#launchCommand viewer-script
#urlCommand "netscape -remote 'openURL(%s)'"
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41232
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
แปลงมาไม่ได้เลยหรอครับ
หรือ อ่านแปลงมาได้บ้างไม่ได้บ้าง
ลองเปลี่ยนที่เก็บ โปรแกรมเป็น C:\\xxxx
หรือ อ่านแปลงมาได้บ้างไม่ได้บ้าง
ลองเปลี่ยนที่เก็บ โปรแกรมเป็น C:\\xxxx
ติดตาม 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
ได้แล้วครับ ผมเปลี่ยน
ปกติใส่
โค้ด: เลือกทั้งหมด
nameToUnicode ./thai/Thai.nameToUnicode
unicodeMap TIS-620 ./thai/TIS-620.unicodeMap
โค้ด: เลือกทั้งหมด
nameToUnicode C:\\Program Files\xpdf\thai\Thai.nameToUnicode
unicodeMap TIS-620 C:\\Program Files\xpdf\thai\TIS-620.unicodeMap
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
Re: สอบถามผู้รู้ แปลง PDF เป็น text หรือ HTML
ทีนี้ถ้าผมจะใช้ PHP เรียกใช้งานผมต้องทำยังไงครับ ต้องเอา xpdf ไปไว้ที่ไหน
สมุมติว่าผมใช้ Appserv ผมจะเขียน php ไปเรียกใช้มันยังไง
สมุมติว่าผมใช้ Appserv ผมจะเขียน php ไปเรียกใช้มันยังไง
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41232
- ลงทะเบียนเมื่อ: 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;
?>
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ อยากทราบวิธีการ แปลง ไฟล์ html มาเป็น pdf
โดย Ittichai_chupol » 18/05/2020 12:26 pm » ใน Programming - PHP - 2 ตอบกลับ
- 1354 แสดง
-
โพสต์ล่าสุด โดย Ittichai_chupol
20/05/2020 1:39 pm
-
-
-
โพสต์ใหม่ แปลง code html เป็น image แต่ไม่แสดงผลลัพธ์
โดย bankjittapol » 12/11/2019 4:44 pm » ใน JavaScript & jQuery Ajax & Node.JS - 4 ตอบกลับ
- 3764 แสดง
-
โพสต์ล่าสุด โดย mindphp
13/11/2019 5:29 am
-
-
-
โพสต์ใหม่ การใช้ Domvas library แปลง code html แปลงหน้าเว็บ เป็นรูปภาพ
โดย bankjittapol » 12/11/2019 6:43 pm » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 1113 แสดง
-
โพสต์ล่าสุด โดย bankjittapol
12/11/2019 6:43 pm
-
-
-
โพสต์ใหม่ การใช้ .text() .html() และ .val() เพื่อเปลี่ยนข้อความ เมื่อกดปุ่ม
โดย bankjittapol » 15/11/2019 2:17 pm » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 1707 แสดง
-
โพสต์ล่าสุด โดย bankjittapol
15/11/2019 2:17 pm
-
-
-
โพสต์ใหม่ การใช้ method text(), html()และ val() ใน jQuery
โดย Parichat » 11/01/2018 11:14 am » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 2383 แสดง
-
โพสต์ล่าสุด โดย Parichat
11/01/2018 11:14 am
-
-
-
โพสต์ใหม่ Tip CSS : Word Breaking (การทำให้ text html element ไม่ล้น)
โดย pprn » 11/07/2018 4:46 pm » ใน CSS Knowledge - 0 ตอบกลับ
- 4305 แสดง
-
โพสต์ล่าสุด โดย pprn
11/07/2018 4:46 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 113