return pageRange.contains(outno);
}
// }}}
+bool ProcessingParameters::havePage(int pageno) const
+{
+ return inputPageRange.contains(pageno);
+}
void ProcessingParameters::dump(pdftopdf_doc_t *doc) const // {{{
{
"pdftopdf: evenPages: %s, oddPages: %s",
(evenPages)?"true":"false",
(oddPages)?"true":"false");
+
+ if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ "pdftopdf: input page range:");
+ inputPageRange.dump(doc);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
"pdftopdf: page range:");
}
std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> pages=proc.get_pages(doc);
- const int numOrigPages=pages.size();
+
+ std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> input_page_range_list;
+
+ for(int i=1;i<=(int)pages.size();i++)
+ if(param.havePage(i))
+ input_page_range_list.push_back(pages[i-1]);
+
+ const int numOrigPages=input_page_range_list.size();
// TODO FIXME? elsewhere
std::vector<int> shuffle;
shuffle.resize(numOrigPages);
std::iota(shuffle.begin(),shuffle.end(),0);
}
- const int numPages=std::max(shuffle.size(),pages.size());
+ const int numPages=std::max(shuffle.size(),input_page_range_list.size());
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
"pdftopdf: \"print-scaling\" IPP attribute: %s",
if ((param.page.width == pw) && (param.page.height == ph))
margin_defined = false;
- for (int i = 0; i < (int)pages.size(); i ++)
+ for (int i = 0; i < (int)input_page_range_list.size(); i ++)
{
- PageRect r = pages[i]->getRect();
+ PageRect r = input_page_range_list[i]->getRect();
int w = r.width;
int h = r.height;
if ((w > param.page.width || h > param.page.height) &&
if (param.fillprint || param.cropfit)
{
- for (int i = 0; i < (int)pages.size(); i ++)
+ for (int i = 0; i < (int)input_page_range_list.size(); i ++)
{
- std::shared_ptr<PDFTOPDF_PageHandle> page = pages[i];
+ std::shared_ptr<PDFTOPDF_PageHandle> page = input_page_range_list[i];
Rotation orientation = param.orientation;
if (param.noOrientation &&
page->is_landscape(param.orientation))
// add empty page as filler
page = proc.new_page(param.page.width, param.page.height, doc);
else
- page = pages[shuffle[iA]];
+ page = input_page_range_list[shuffle[iA]];
PageRect rect;
rect = page->getRect();