View Single Post
Old 02-08-2007, 07:35 PM   #1
harpum
Enthusiast
harpum began at the beginning.
 
Posts: 47
Karma: 24
Join Date: Jan 2007
Device: Axim 51v/LG chocolate
Simple iliad cutting latex file for long page.

When I see letter size files, becuase height is two long, Iliad try to scale to small size. I cannot read it directly, I usually zoom it.

If I fit page to iliad width and cut one long page to 2 page,
I can easily see it without zooming and reduce time.

So I made very adhoc latex file.
Of course, this file is very simple and very ugly. But I believe some people upgrade it easily.

I believe someone can add hyperlinks in the second page which have a lot of free space.
Of course it will be possible to add TOC.

Thank you.

PS. I recommand crop file before converting.
I used pdflatex in Miktex.
--------------------------------------------------------
\documentclass{article}
\unitlength=1pt
\def\startp{1} %%% start page
\def\endp{27} %%% end page+1
\def\overlaprate{0.007} % percentage for overlap
\def\errfactor{1} % additional scale factor. You can enlarge or reduce it.
\def\fname{manual.pdf} % file name
\newlength{\paperx}
\setlength{\paperx}{347pt}% iliad page size(x-coordinate)
\newlength{\papery}
\setlength{\papery}{427pt} % iliad page size(y-coordinate)
\newlength{\pagex}
\newlength{\pagey}
\newlength{\cuty}
\newlength{\scale}
\newlength{\resultovery}
\newlength{\resulty}
\makeatletter
\newcommand*{\px}{\strip@pt\paperx}
\newcommand*{\py}{\strip@pt\papery}
\newcommand*{\pgx}{\strip@pt\pagex}
\newcommand*{\pgy}{\strip@pt\pagey}
\newcommand*{\cy}{\strip@pt\cuty}
\newcommand*{\sca}{\strip@pt\scale}
\newcommand*{\ry}{\strip@pt\resulty}
\newcommand*{\roy}{\strip@pt\resultovery}
\newcommand{\npt}[1]{\strip@pt#1}
\makeatother
\usepackage[paperwidth=\paperx,paperheight=\papery,margin={0pt ,0pt},pdftex,nohead,nofoot]{geometry}
\usepackage{ifthen,pdfpages,calc,hyperref}
\newcounter{pg}
\setcounter{pg}{\startp}
\begin{document}
%\tableofcontents
\title{Test File\\
Hi!!}
\date{}
\maketitle %%% You can make your own cover!
\center
\whiledo{\value{pg}<\endp}{
\setbox1=\hbox{
\expandafter\includegraphics[page=\thepg]{\fname}
}
\setlength{\pagex}{\the\wd1}
\setlength{\pagey}{\the\ht1}
\setlength{\scale}{\paperx *\real{\errfactor}/ \real{\pgx}}
\setlength{\cuty}{\pagey *\real{\sca}-\papery}
\setlength{\resulty}{\cuty / \real{\sca}}
\setlength{\resultovery}{\resulty + \pagey*\real{\overlaprate}}
\includegraphics[scale=\sca,viewport={{0} {\ry} {\pgx} {\pgy}},page=\thepg]{\fname}
\ifthenelse{\papery < \pagey}
{
\expandafter\includegraphics[scale=\sca,viewport={{0} {0} {\pgx} {\roy}},page=\thepg]{\fname}
}{}
\addtocounter{pg}{1}
}
\end{document}
Attached Files
File Type: pdf manual.pdf (444.0 KB, 907 views)
File Type: pdf sample.pdf (465.5 KB, 672 views)

Last edited by harpum; 02-08-2007 at 07:41 PM.
harpum is offline   Reply With Quote