Hello everyone, my question is this I am trying to use the function pdf2jpg
in python but it is impossible for me to upload the PDF file
from pdf2jpg import pdf2jpg
import sys,os
_dirPDF=sysVar.Get("VarDirPDF") # funcion propia devuelve "C:/Users/Tor/Desktop/aqui/t.pdf"
_Instdir=sysVar.Get("VarInstalationDir") # funcion propia devuelve "C:/Users/Tor/Desktop/PROGRAMAS/script_folder"
_thumbFOLDER="{}{}{}".format(_Instdir,"/imagenes","/thumb/") # variable _thumbFOLDER='C:/Users/Tor/Desktop/PROGRAMAS/script_folder/imagenes/thumb/'
_file="{}{}".format(file_name,file_extension) # variable file_name vale "t" y variable file_extension vale ".pdf"
# por lo tanto _file="t.pdf"
_file_="{}{}{}{}".format("\"",_dirPDF,_file,"\"") #variable _file_='"C:/Users/Tor/Desktop/aqui/t.pdf"'
_fileJPG="{}{}".format(file_name,".jpg") #variable _fileJPG="t.jpg"
inputpath = os.path.dirname(_dirPDF)+"/t.pdf"
outputpath = _thumbFOLDER
# To convert single page
result = pdf2jpg.convert_pdf2jpg(inputpath, outputpath, pages="1")
#el error se da aca cuando 'pdf2jpg.convert_pdf2jpg' trata de cargar 'inputpath'
print(result)
and this always gives error error [WinError 2] The system can not find the specified file
I have tried to change the imputpat inputpath = os.path.dirname(_dirPDF)+"t.pdf"
in different ways:
indicating the file directly
os.chdir(_dirPDF)
inputpath = "t.pdf"
where _dirPDF="C: / Users / Tor / Desktop / here"
passing address and file
inputpath = _file_
where _file="C: /Users/Tor/Desktop/aqui/t.pdf"
or
inputpath = r"C:/Users/Tor/Desktop/aqui/t.pdf"
and nothing always ends giving error error [WinError 2] The system can not find the specified file
NOTE: if anyone can help me create the error pdf2jpg tag, and [WinError 2] or complete [WinError 2] The system can not find the specified file would be great;)
I hope you can help me,
Thanks !!!!