You can use "ImageMagick" module to convert a PDF file to a PNG file. You need to first install "ImageMagick" on Ubuntu machine using the following command:
sudo apt install imagemagick
To convert PDF to PNG, use the following command:
convert -density 300 input.pdf output.png
"-density 300": Sets the resolution to 300 DPI for better quality. You can change it as per your requirements.
"input.pdf": Replace with the path to your PDF file.
"output.png": Replace with the desired name for the PNG file.