BIBLIOGRAPHY
History
- Translate from pdf-epub with pandoc and marker
Related-Notes
pdf에서 변환하는 방법
pandoc 에서 pdf 파일은 입력으로 못받는다. 다른 툴이 있다. 먼저 파일 사이즈가 큰 경우는 이미지로 변환된 파일일 것이다. 그건 안된다.
pdf2docs — pdf to docx 변환
한방에 잘 되면 나이스이다.
pip install pdf2docx
pdf2docx convert test.pdf test.docx
xpdf — PDF 도구 모음
- xpdf: PDF 뷰어
pdftotext: PDF 를 텍스트로 변환
pdftops: PDF 를 포스트스크립트(PostScript)로 변환
pdftoppm: PDF 페이지들을 netpbm(PPM/PGM/PBM) 이미지 파일들로 변환
pdftopng: PDF 페이지들을 PNG 이미지 파일들로 변환
pdftohtml: PDF 를 HTML 로 변환
pdfinfo: PDF 메타데이터를 추출
pdfimages: PDF 파일들로부터 원시 이미지(raw image)들을 추출
pdffonts: PDF 파일에 사용된 폰트 목록을 나열
pdfdetach: PDF 파일에 첨부된 파일들을 추출
$ pdftotext Olsen_2018_Getting_Clojure.pdf
calibre : pdf to epub
https://softhints.com/how-to-convert-pdf-to-epub-with-linux/
- Step 1: Install calibre
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin install_dir=/opt ;; sudo apt install calibre
- Step 2: Convert PDF file to ePUB
In this section, we’ll see how to convert PDF file to ePUB with command - ebook-convert. For better results we will use parameter - —enable-heuristics:
ebook-convert book.pdf book.epub --enable-heuristics
The command will convert the PDF file to ePUB page by page. Note - command needs to be executed in the folder where the PDF files are located.
-
Heuristic Processing With flag —enable-heuristics we can control the strcuture and different options. There are different flags like:
—disable-dehyphenate —disable-delete-blank-paragraphs —disable-fix-indents —disable-format-scene-breaks —disable-italicize-common-cases —disable-markup-chapter-headings —disable-renumber-headings —disable-unwrap-lines —html-unwrap-factor —replace-scene-breaks
More information about command ebook-convert is available on this link: Calibre - ebook-convert
-
Step 3: Convert mulitple PDF to ePUB Finally, let’s convert multiple PDF files to ePUB with single command:
find ./ -iname "*pdf" -type f | while read f; do echo -e "\e[1mConverting file $f \e[0m" ; ebook-convert "$f" "${f%.pdf}.epub" --enable-heuristics ; done
How the command works?
it search for PDF files in the current folder it prints out the file name Converting file ./book1.pdf start conversion with option —enable-heuristics
DONT calibre epub to pdf ? no
반대로 하면 된다.
ebook-convert book.pdf book.epub --enable-heuristics
html 로 변환하고 거기서 pdf 저장하는게 좋겠다.
TODO PDF -> 이미지 -> 문서화 방법
용어사전으로 해야 하나? 아니면 용어 사전이 좋을 것 같다. 왜?! 사실 한자말을 기준으로 봐야 할 것이다.
- #FIXME 52e1c2f4-ce87-42d2-8b35-f32827fc39d1][배움낱말 모음]]
배움낱말을 다 입력하려면 힘들다. 아 보니까 이런 양이 많지 않구나.
아무튼 아래와 같이 변환하면 된다.
- #FIXME aabe7f74-a6b0-447e-8946-f11cf7304d6a][ithink]]
PDF를 이미지로 변환
pdf를 어떻게 해 놨는지 한글을 뽑아 낼 수가 없더라. 이미지로 만들어서 광학 인식하는 수 밖에.
pdftoppm ithink-100_배움낱말.pdf output -png
OCR: tesseract 활용
sudo apt-get install tesseract-ocr-kor
png 파일을 다 변환해준다.
for FILE in *.png; do tesseract -c preserve_interword_spaces=1 $FILE ${FILE::-4} -l kor+eng --psm 4 ; done
for FILE in *.png; do tesseract -c preserve_interword_spaces=1 $FILE ${FILE::-4} -l kor --psm 4 ; done
for FILE in *.png; do tesseract $FILE ${FILE::-4} -l kor ; done
Converting multiple images to a single PDF file.
On Linux, you can list all images and then pipe them to tesseract
ls *.jpg | tesseract - yourFileName txt pdf
Where:
youFileName: is the name of the output file.
txt pdf: are the output formats, you can also use only one of them.
Converting images to individual text files On Linux, you can use the for loop to go through files and execute an action for every file.
for FILE in *.jpg; do tesseract $FILE ${FILE::-4}; done
Where:
for FILE in *.jpg : loop through all JPG files (you can change the extension based on your format)
$FILE: is the name of the image file, e.g. 001.jpg
${<:-4>}: is the name of the image but without the extension, e.g. 001.jpg will be 001 because we removed the last 4 characters.
We need this to name the text files to the corresponding names, e.g.
001.jpg will be converted to 001.txt 002.jpg will be converted to 002.txt
하나의 문서로 합쳐라.
아. 디레드로 만들어 놓은 함수가 있다.