콘솔워크

html tag를 pdf로 저장하는 라이브러리 pdfkit 본문

프로그래밍/python

html tag를 pdf로 저장하는 라이브러리 pdfkit

이휘재123 2023. 7. 17. 17:49
반응형
pip install pdfkit

해당 라이브러리를 windows 환경에서 사용하기 위해서는 사전에 wkhtmltopdf를 설치해야 합니다.

https://wkhtmltopdf.org/downloads.html

 

wkhtmltopdf

All downloads are currently hosted via GitHub releases, so you can browse for a specific download or use the links below. Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete ta

wkhtmltopdf.org

본인의 컴퓨터 환경에 맞게 다운받아주세요.

 

해당 exe파일로 설치합니다.

저는 기본 설정으로 설치했습니다.

 

 

설치가 완료되면, C:\Program Files\wkhtmltopdf\bin 폴더에 wkhtmltopdf.exe 파일이 있는지 확인합니다.

정상적으로 설치된 모습

 

작업하고자 하는 프로젝트의 가상환경 'venv' 폴더의 'Scripts' 폴더로 이동합니다.

 

wkhtmltopdf.exe파일을 해당 폴더에 복사해주세요.

그 후, 해당 파일의 이름을 wkhtmltopdf로 변경합니다.

 

 

 

 

반응형