Changes

Jump to navigation Jump to search
1,015 bytes added ,  04:10, 1 June 2020
m
→‎Visualize Bounding Box: <pre> no longer processes tags ...
The conversion generates a PDF file with prefix <tt>m_k_i_v_</tt> and a suffix <tt>.pdf</tt> added to the name of the original file. The result is cached, and the conversion is rerun if the timestamp of the original file is newer than that of the converted file.
 
It is possible to change the converter used with the following code:
 
<pre>
\startluacode
local function converter(oldname, newname, resolution)
if not resolution or resolution == "" then
resolution = 50
end
os.execute(string.format(
'convert -density %ix%i "%s" "%s"',
resolution, resolution, oldname, newname)
)
end
 
-- Set the PDF and default TIFF converters to the above function.
figures.converters.tif.pdf = converter
figures.converters.tif.default = converter
\stopluacode
 
\starttext
% Substitute any TIFF here.
\externalfigure[cow.tiff]
\stoptext
</pre>
 
See also: https://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua
== Interaction ==
<texcode>\clip[nx=3,ny=3,x=2,y=2]
{\externalfigure[logo.pdf]}</texcode>
 
 
In PDF files, it is possible to specify different size information in PDF headers MediaBox, TrimBox, CropBox, and ArtBox. To clip to one of these sizes, use
 
<texcode>\externalfigure[logo.pdf][size=art]</texcode>
 
Other options are: `none` (detault), `media` for MediaBox, `crop` for CropBox, `trim` for TrimBox, and `art` for ArtBox.
= Troubleshooting =
ConTeXt includes a Perl script <tt>pdftrimwhite</tt> that removes extra white space at the borders of a PDF file. To run this script:
<pre>mtxrun --script pdftrimwhite <em>[flags] input output</em></pre>
The most important flag is <tt>--offset=dimen</tt>, which keeps some extra space around the trimmed image.

Navigation menu