Method #1 - pdfcrop
There's a command line tool called pdfcrop
that sounds like what you're looking for.
pdfcrop is a utility to calculate and remove empty margins from each
page in the input PDF file. The resulting output file occupies the
minimal paper size needed for the contents and is therefore suitable
for inclusion as a graphic
Examples
$ pdfcrop --margins 10 input.pdf output.pdf
$ pdfcrop --margins ’5 10 5 20’ --clip input.pdf output.pdf
Method #2 - pdfjam
As an alternative there's another tool called pdfjam
.
$ pdfjam --twoside --offset '2cm 0cm' file.pdf
References
If I am understanding the question, and you have vim installed on the system (this could work with vi
as well, as these are just ex
commands)
Running the below command at a terminal, will:
- read in the file:
xorg.conf
- obviously replace this with the file you want to modify. Note: this file xorg.conf
will not be modified, in case something goes wrong with the script.
- do some text manipulation
- the output of the commands will be place in file:
/tmp/temp_xorg.conf
If after these operations, you are satisfied with the state of /tmp/temp_xorg.conf
you could copy it to the location of your real, working xorg config file.
run the commands
run this at a shell prompt to produce fontpaths directories which are in a format that can go in an xorg conf file (thanks to @meuh for this command).
fc-list : file | sed -E 's#(.*)/.*#\tFontPath "\1"#' | sort -u > /tmp/filepaths.txt
then run this command, which will take the output of the above command and insert it into the "Files" sections
$ vim -e xorg.conf << 'EOF'
" move cursor to the line with the text: `Section "Files"`
/Section "Files"
" read in the output of `fc-list` at this point
r !fc-list
write /tmp/temp_xorg.conf
EOF
so if for example, xorg.conf
looked like this:
Section "InputClass"
Identifier "trackpoint catchall"
MatchIsPointer "true"
MatchProduct "TrackPoint|DualPoint Stick"
MatchDevicePath "/dev/input/event*"
Option "Emulate3Buttons" "true"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
Section "Files"
Identifier "trackpoint catchall"
MatchIsPointer "true"
MatchProduct "TrackPoint|DualPoint Stick"
MatchDevicePath "/dev/input/event*"
Option "Emulate3Buttons" "true"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
Section "InputClass"
Identifier "trackpoint catchall"
MatchIsPointer "true"
MatchProduct "TrackPoint|DualPoint Stick"
MatchDevicePath "/dev/input/event*"
Option "Emulate3Buttons" "true"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
After running the above command /tmp/temp_xorg.conf
should look like this:
Section "InputClass"
Identifier "trackpoint catchall"
MatchIsPointer "true"
MatchProduct "TrackPoint|DualPoint Stick"
MatchDevicePath "/dev/input/event*"
Option "Emulate3Buttons" "true"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
Section "Files"
FontPath "/home/ubuntu/.fonts"
FontPath "/usr/share/fonts/opentype/noto"
FontPath "/usr/share/fonts/opentype/stix"
FontPath "/usr/share/fonts/opentype/stix-word"
FontPath "/usr/share/fonts/truetype"
FontPath "/usr/share/fonts/truetype/abyssinica"
FontPath "/usr/share/fonts/truetype/ancient-scripts"
FontPath "/usr/share/fonts/truetype/dejavu"
FontPath "/usr/share/fonts/truetype/fonts-guru-extra"
FontPath "/usr/share/fonts/truetype/freefont"
FontPath "/usr/share/fonts/truetype/kacst"
FontPath "/usr/share/fonts/truetype/kacst-one"
FontPath "/usr/share/fonts/truetype/lao"
FontPath "/usr/share/fonts/truetype/lato"
FontPath "/usr/share/fonts/truetype/liberation"
FontPath "/usr/share/fonts/truetype/lohit-punjabi"
FontPath "/usr/share/fonts/truetype/nanum"
FontPath "/usr/share/fonts/truetype/openoffice"
FontPath "/usr/share/fonts/truetype/padauk"
FontPath "/usr/share/fonts/truetype/sinhala"
FontPath "/usr/share/fonts/truetype/takao-gothic"
FontPath "/usr/share/fonts/truetype/tibetan-machine"
FontPath "/usr/share/fonts/truetype/tlwg"
FontPath "/usr/share/fonts/truetype/ttf-khmeros-core"
FontPath "/usr/share/fonts/truetype/ubuntu-font-family"
FontPath "/usr/share/fonts/type1/gsfonts"
FontPath "/usr/share/fonts/X11/Type1"
Identifier "trackpoint catchall"
MatchIsPointer "true"
MatchProduct "TrackPoint|DualPoint Stick"
MatchDevicePath "/dev/input/event*"
Option "Emulate3Buttons" "true"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
Section "InputClass"
Identifier "trackpoint catchall"
MatchIsPointer "true"
MatchProduct "TrackPoint|DualPoint Stick"
MatchDevicePath "/dev/input/event*"
Option "Emulate3Buttons" "true"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
Best Answer
I was able to figure out the fonts, using
pdffonts
(from Xpdf):Actually you can also see it in Evince when open the file in Properties but that doesn't help.
It became clear that in okular it works but not in evince which means something is wrong in evince. Now as poppler is responsible for all font rendering and all have filed a bug upstream https://bugs.freedesktop.org/show_bug.cgi?id=99304 where it will hopefully be fixed.