pdf2image icon indicating copy to clipboard operation
pdf2image copied to clipboard

pdf2image transform pdf to image error

Open sususu1 opened this issue 4 years ago • 4 comments

when i used pdf2iamge to change pdf to images, some image dispaly chinese font with □□.while other pdf trans properly! how can i solve this problem, thanks help me!

sususu1 avatar Sep 09 '21 12:09 sususu1

Some PDF embedded the font inside of themselves. Poppler can render these on any system. Other PDF generator will assume that the computer reading the PDF has the right fonts and expects them to be there..

You probably just need to install some Chinese fonts on the machine that does the conversion. You should be able to get a more helpful message by doing:

pdftoppm -r 200 -jpeg your_file.pdf out and look at the output as a missing font should be indicated.

Belval avatar Sep 19 '21 18:09 Belval

You can install the following libraries on ubuntu to resolve this issue. Due to the lack of Asian fonts on the system (Linux), it usually happens. Once you install it on your machine, the poppler can easily show the content properly and □□ will not be there in the output.

sudo apt-get install fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core

So, You need to follow the below steps to install the pdf2image library and use it for Asian languages:

<<< Step 1 >>>

sudo apt-get install poppler-utils
sudo apt-get install poppler-data

<<< Step 2 >>>

sudo apt-get install fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core

<<< Step 3 >>>

pip install pdf2image

<<< Step 4 >>>

pdftoppm -r 200 -jpeg input.pdf > output.jpg

hiteshkalwani avatar Feb 14 '22 07:02 hiteshkalwani

You can install the following libraries on ubuntu to resolve this issue. Due to the lack of Asian fonts on the system (Linux), it usually happens. Once you install it on your machine, the poppler can easily show the content properly and □□ will not be there in the output.

sudo apt-get install fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core

So, You need to follow the below steps to install the pdf2image library and use it for Asian languages:

<<< Step 1 >>>

sudo apt-get install poppler-utils
sudo apt-get install poppler-data

<<< Step 2 >>>

sudo apt-get install fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core

<<< Step 3 >>>

pip install pdf2image

<<< Step 4 >>>

pdftoppm -r 200 -jpeg input.pdf > output.jpg

thx,it works in my problems!

sususu1 avatar Feb 16 '22 01:02 sususu1

Hi @Belval, We can close this issue, as the ASIAN fonts were not installed in the system led to this issue. So better install the fonts in the first place and then use this library in the environment.

hiteshkalwani avatar Feb 16 '22 05:02 hiteshkalwani