Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert PDF to an Image without text

I would like to know if its possible to convert a PDF to and image without fonts. My goal is to have only the image without text ?

And if yes, can I do it with ImageMagick/GhostScript ?

Here an example

The image final http://crocodoc_public.s3.amazonaws.com/8b8aa154-45e3-41f9-a465-628e1b2e955d/images/page-001.png

and the original PDF http://crocodoc.com/demo/efwpa (page 2) We can see that the text are on overlay over the image, what I want is to do the same.

like image 899
yvan Avatar asked Sep 09 '11 10:09

yvan


2 Answers

So if I got you right, what you want is to remove some text from your PDF (not fonts), and you want to do it programmatically. I suspect you know already that this will only possible if the text is placed on some kind of separate layer in your PDF files. You can try to utilize iText for that. Beware, this will mean you will have to invest some days of learning how to use that library.

like image 68
Doc Brown Avatar answered Nov 10 '22 01:11

Doc Brown


I too am the lookout for something like that. While playing with imagemagick I tried this a command and got some unexpected results.

convert -input.pdf -blur 0x0 output.jpg

this removes the text layers from the pdfs I tried.

I cannot guarantee that this will work for you and if this the right way to achieve, but you may try.

like image 41
codin Avatar answered Nov 10 '22 02:11

codin