/** Collect all background color changes while preprocessing the DVI file. * We need them in order to apply the correct background colors even if * not all but only selected DVI pages are converted. */ void BgColorSpecialHandler::preprocess (const char*, std::istream &is, SpecialActions &actions) { Color color = ColorSpecialHandler::readColor(is); unsigned pageno = actions.getCurrentPageNumber(); if (_pageColors.empty() || _pageColors.back().second != color) { if (!_pageColors.empty() && _pageColors.back().first == pageno) _pageColors.back().second = color; else _pageColors.push_back(PageColor(pageno, color)); } }
void PapersizeSpecialHandler::preprocess (const string&, std::istream &is, SpecialActions &actions) { string params; is >> params; Length w, h; const size_t splitpos = params.find(','); try { if (splitpos == string::npos) { w.set(params); h.set(params); } else { w.set(params.substr(0, splitpos)); h.set(params.substr(splitpos+1)); } storePaperSize(actions.getCurrentPageNumber(), w, h); } catch (UnitException &e) { // ignore invalid length units for now } }