Automatic clipping of PDF files (auto Chebai edge)
From:http://www.ai7.org/wp/html/754.html
possible environment, tools: Ubuntu 10.04+texlive 2008+pdfcrop+cups print driver, with Windows Brothers do not have to look, these tools are theoretically under Windows, but also have a lot of other things.
The following assumes that the original file (that is, the file intended to Chebai side) is called Abc.pdf
- Pdfcrop Abc.pdf, the default is to generate Abc-crop.pdf files, this is already cut off the white edge, if you do not think it big (or it is really small), it is finished.
- Open abc-crop.pdf with a reader (such as evince) and print to a file through cups, pay attention to closing all commands related to page scaling and check "use document page size as page size". Print, Finish.
Description
- Pdfcrop is actually brought by Texlive. is essentially a Perl script.
- Pdfcrop to call GS (Ghostscript) to determine the white edge size of each page. For blank pages, the error will be ignored.
- Pdfcrop can also leave a few pixels at the time of cutting, specifically please help.
- Pdfcrop to call pdfTeX to generate the file after the Chebai edge.
- Pdfcrop in essence (conjecture, no reading source) is the first to expand the abc.pdf into a single-page PDF, call the GS Chebai side, and then use Tex file directly to call the PDF page, and finally generate output with pdfTeX.
- Pdfcrop directly generated files are generally more than 20 times times the original file (I test several files are so), virtual printing to a new file, the basic can be restored to the same order of magnitude of the original file size.
- The tests are both in English and Chinese PDF using the inline fonts. Scan version of the trial, the estimate is too tough.
With a similar EPS version tool
First use the following command to remove the white edge. Because it is a program to do, the effect of removing white edges is even better than the person himself:
Epstool--copy--bbox input_file.eps input_file_temp.eps
The second and final step is to convert the EPS image to PDF and only one line of command
Epstopdf--hires--outfile=output.pdf Input_file_temp.eps
This completes the conversion of EPS to PDF.
The above procedure can be written as a script
Epstool--copy--bbox $ my_epstopdf_temp.eps
Epstopdf--hires--outfile=$2 My_epstopdf_temp.eps
RM my_epstopdf_temp.eps
"Go" PDF file Auto Chebai Edge