pdf to jpg

dotKer

Member
Joined
Aug 16, 2019
Messages
69
Reaction score
14
Credits
0
I have a pdf.
Can I change it to jpg, or other image format for displaying on a webpage in xubuntu?
 


G'day dotKer.

If you are using Firefox in your Xubuntu, and you have the PDF saved to your hard drive or on a USB stick, you can open it in Firefox through Open File.

PDF are designed for web use and so can appear in a browser.

With Chromium it is a different story.

Cheers

Wiz
 
As Wiz has said - many browsers support viewing .pdf files out of the box - and others do require some kind of plugin/extension, or even a standalone pdf viewer. So you might not need to convert your pdf to images at all.

However, if you really want/need to - you can easily convert a .pdf to a series of .jpg images.

First up - What type of PDF are you converting?
Is it a pdf that has been exported from an office suite, or some other program - or compiled from a markup language like LaTex?
Or is it a scanned document?

If it's a scanned document - then each page will already exist as a JPG, embedded into the pdf. So it might be easier to use something that can extract images from pdf documents.

I know there are a few tools available in Linux that can do this. I think one of them is called pdfimages. It should be in the repos of most distros.

So if your pdf is a scanned document - you'd probably be better off installing pdfimages and using that to extract all images.

Otherwise, if your PDF is NOT a scanned document - your best bet would be to use imagemagicks "convert" program.

Imagemagick is a suite of powerful terminal-based image manipulation tools and should be in the software repos for your distro.

If you have imagemagick installed - it might be as simple as:
Code:
convert file.pdf file.jpg
That should export each page of the document as a series of jpg images. And if you're lucky - the images will be good to use.

But depending on the quality of the results - you might need to add some extra parameters to the call to convert - e.g. to set or change the colourspace, the size/resolution of the converted images etc.

So, if using convert without parameters results in poor quality images being exported - you can try some of converts many options to try to improve the final .jpgs.

To see the available options - consult the man pages for convert:
Code:
man convert

Then you can decide which of the options might be able to improve the final result. So it may require a little bit of tinkering to get the exported images exactly as you want them.



Although pdfimages and convert (and the rest of the imagemagick tools) are terminal based, command-line tools. They are all extremely powerful and very useful.

If you have a large number of pdf files to convert - you can easily write a script to use them to batch convert/extract .jpg from .pdf.
 
Last edited:
A logical question for friend dotKer in three parts is:
  1. How many pages in the PDF?
  2. Do the pages consist of text, pictures, or text and pictures?
  3. Is it only the one PDF you wish to do this with, or are there (likely to be) others?
Cheers all, and welcome to linux.org @alfian :)

Chris Turner
wizardfromoz
 
  1. How many pages in the PDF?
  2. Do the pages consist of text, pictures, or text and pictures?
  3. Is it only the one PDF you wish to do this with, or are there (likely to be) others?
(1) 1 page
(2) text and pictures, ie, seal and signaure at the PDF attached which is an example.
(3) only one PDF at the moment.
-----I possibly need to convert xls to jpg. later but not at the moment.

I like to convert a PDF attached which is an example to jpg, jpeg, or png because I like to insert into a html file for displaying it with the html page.
 

Attachments

  • scan01.pdf
    425.9 KB · Views: 699
Last edited:
Does this look acceptable?

It is titled scan01.jpg

znmy0ov.jpg


Might need to do some "tweaking" with the border sizing/page format.

If you have LibreOffice on your Xubuntu, then you may well have LibreOffice Draw.

Open the PDF from Draw, then from the Menu, choose "Export...", not "Export As"

There you can choose jpeg/jpg and save.

HTH (Hope This Helps)

Chris
 
Does this look acceptable?
Yes, it does.

If you have LibreOffice on your Xubuntu, then you may well have LibreOffice Draw.
I have LibreOffice, LibreOffice Calc, LibreOffice Math, and LibreOffice Writer, but don't have LibreOffice Draw.

Which LibreOffice one should I use for LibreOffice Draw?
OR
How to download LibreOffice Draw?
 
At Terminal, try

Code:
apt-cache policy libreoffice-draw*

If you get a result like, for example

libreoffice-draw.x86_64

Then it is a case of

Code:
sudo apt-get -y install libreoffice-draw.x86_64

It should then appear in Menu under Office

Wizard
 
apt-cache policy libreoffice-draw*
As I type the above in the terminal, it says the following.
$ apt-cache policy libreoffice-draw*
libreoffice-draw:
Installed: (none)
Candidate: 1:6.0.7-0ubuntu0.18.04.10
Version table:
1:6.0.7-0ubuntu0.18.04.10 500
500 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
1:6.0.3-0ubuntu1 500
500 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
$
It seems a little different from I expected.
Should I enter the following for installing libreoffice-draw?
sudo apt-get -y install libreoffice-draw.x86_64
What does it mean by x86_64?
Is it version number?
 
No, my bad - I was on Fedora (RPM-based) when I answered your question.

So for you it is

Code:
sudo apt-get -y install libreoffice-draw

The -y is simply to OK changes being made, rather than being prompted to choose Yes or No.

It is safe to do that when you are installing a software package that is held in your Distro's Repositories, that is, in this case, the Ubuntu Repository.

Wizard
 
I think Deli PDF Converter can help you convert pdf to jpg or other image formats. You can try it.
 

Members online


Latest posts

Top