Archive for March, 2006
Printing Envelopes on the ML-2010 with TeX
I recently needed to print some size 10 envelopes using a Samsung ML-2010 laser printer under Linux. While printing envelopes using OpenOffice is possible, after a few trial runs I wasn’t really happy with the output and decided TeX/LaTeX might be better suited to the job. Adapting Michael Stutz’s code from here gave me the following:
% envelope.tex
% Print a #10 envelope
\font\cmssa = cmss12
\font\cmssc = cmss14
%setup:
\parindent 0 pt\nopagenumbers\parskip 10 pt
\hsize 9.5 in\vsize 3.25 in
\voffset 1.25 in
\cmssc
%document:
FROM-NAME
FROM-STREET ADDRESS
FROM-CITY, STATE, \ ZIP
\vskip .4 in\parindent 3.5 in
TO-NAME
TO-STREET ADDRESS
TO-CITY, STATE, \ ZIP
\end
Compile with:
tex envelope.tex; dvips -t landscape -m envelope.dvi
Then you can print with cupsdoprint or your favorite PostScript printing application. The envelopes should be inserted landscape-style, face up, open edge on the right side, in the center of the feed tray with all other paper removed and the guide tabs adjusted to fit the height of the envelope. The source TeX file is also available here.
libavcodec / libavformat sample code
Due to some changes in libavformat, the sample code at http://www.inb.uni-luebeck.de/~boehme/libavcodec_update.html no longer compiles correctly.
avcodec_sample.0.4.9.cpp: In function ‘int main(int, char**)’:
avcodec_sample.0.4.9.cpp:83: error: request for member ‘codec_type’ in
‘pFormatCtx->AVFormatContext::streams[i]->AVStream::codec’,
which is of non-class type ‘AVCodecContext*’
avcodec_sample.0.4.9.cpp:92: error: cannot convert ‘AVCodecContext**’
to ‘AVCodecContext*’ in assignment
avcodec_sample.0.4.9.cpp:105: error: ‘struct AVCodecContext’ has
no member named ‘frame_rate’
avcodec_sample.0.4.9.cpp:105: error: ‘struct AVCodecContext’ has
no member named ‘frame_rate_base’
avcodec_sample.0.4.9.cpp:106: error: ‘struct AVCodecContext’ has
no member named ‘frame_rate_base’
I’ve created a patch as well as a fixed example for the code. I’m not entirely sure about commenting out the frame rate correction hack, but those frame rate variables are no longer members of the AVCodecContext struct.
Also, for compiling under Debian, the recommended usage is not to change the include directives, but to use:
g++ `ffmpeg-config --cflags` -o filename filename.cpp
`ffmpeg-config --libs avformat --libs avcodec`