Showing posts with label pdf. Show all posts
Showing posts with label pdf. Show all posts

Tuesday, April 11, 2023

How to convert plain text file (.txt) into PDF via LibreOffice command-line?

Nowadays, major Linux distributions come with LibreOffice pre-installed.  Isn't it better for text-based users to use LibreOffice's command-line tool to convert their plain text files into PDF without having to install other programs?

% libreoffice --convert-to "pdf" file.txt

Friday, January 23, 2015

how to convert pdf to jpg or png with high quality result with imagemagick

If the pdf file contains only images:

 

convert -density 150 -trim input.pdf -quality 100 -sharpen 0xx1.0
output.jpg

 

But, if the pdf file contains both images and text:

 

convert  -density 288 model-of-the-standing-desk.pdf -background white -flatten -resize 80% model-of-the-standing-desk.png

 

You may also need to add this line:

 

 <policy domain="coder" rights="read | write" pattern="PDF" />

 

inside the file /etc/ImageMagick-7/policy.xml

just before the line:

 

 </policymap>


too.