orientation = param.normal_landscape;
else
orientation = ROT_0;
- page->crop(param.page, orientation, param.xpos, param.ypos,
- !param.cropfit, doc);
+ page->crop(param.page, orientation, param.orientation, param.xpos, param.ypos,
+ !param.cropfit, param.autoRotate, doc);
}
if (param.fillprint)
param.fitplot = true;
// fscale: inverse_scale (from nup, fitplot)
virtual void add_border_rect(const PageRect &rect,BorderType border,float fscale) =0;
// TODO?! add standalone crop(...) method (not only for subpages)
- virtual Rotation crop(const PageRect &cropRect,Rotation orientation,Position xpos,Position ypos,bool scale,pdftopdf_doc_t *doc) =0;
+ virtual Rotation crop(const PageRect &cropRect,Rotation orientation,Rotation param_orientation,Position xpos,Position ypos,bool scale,bool autorotate,pdftopdf_doc_t *doc) =0;
virtual bool is_landscape(Rotation orientation) =0 ;
virtual void add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL) =0;
virtual void mirror() =0;
* Trim Box is used for trimming the page in required size.
* scale tells if we need to scale input file.
*/
-Rotation QPDF_PDFTOPDF_PageHandle::crop(const PageRect &cropRect,Rotation orientation,Position xpos,Position ypos,bool scale,pdftopdf_doc_t *doc)
+Rotation QPDF_PDFTOPDF_PageHandle::crop(const PageRect &cropRect,Rotation orientation,Rotation param_orientation,Position xpos,Position ypos,bool scale,bool autorotate,pdftopdf_doc_t *doc)
{
page.assertInitialized();
Rotation save_rotate = getRotate(page);
double final_w,final_h; //Width and height of cropped image.
Rotation pageRot = getRotate(page);
- if (((pageRot == ROT_0 || pageRot == ROT_180) && pageWidth <= pageHeight) ||
- ((pageRot == ROT_90 || pageRot == ROT_270) && pageWidth > pageHeight))
+ if ((autorotate &&
+ (((pageRot == ROT_0 || pageRot == ROT_180) &&
+ pageWidth <= pageHeight) ||
+ ((pageRot == ROT_90 || pageRot == ROT_270) &&
+ pageWidth > pageHeight))) ||
+ (!autorotate &&
+ (param_orientation == ROT_90 || param_orientation == ROT_270)))
{
std::swap(pageHeight,pageWidth);
}
virtual void mirror();
virtual void rotate(Rotation rot);
virtual void add_label(const PageRect &rect, const std::string label);
- virtual Rotation crop(const PageRect &cropRect,Rotation orientation,Position xpos,Position ypos,bool scale,pdftopdf_doc_t *doc);
+ virtual Rotation crop(const PageRect &cropRect,Rotation orientation,Rotation param_orientation,Position xpos,Position ypos,bool scale,bool autorotate,pdftopdf_doc_t *doc);
virtual bool is_landscape(Rotation orientation);
void debug(const PageRect &rect,float xpos,float ypos);
private: