Page orientation only respected when using custom paper size

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Page orientation only respected when using custom paper size

Postby emerick » Wed Jan 12, 2011 8:38 am

I implement HandlePrintOptions in CEF to set custom margins and change the page orientation. Setting the margins works correctly, but changing the page orientation to landscape doesn't seem to work. In looking at CEF's source code, I noticed the following snippet in PrintSettings::Init (print_settings.cc):

Code: Select all
if (is_custom_paper) {
    page_measurements.page_length = ConvertUnitDouble(
      static_cast<double>(physical_size_pixels.height()),
      static_cast<double>(dpi_),
      static_cast<double>(desired_dpi));
    page_measurements.page_width = ConvertUnitDouble(
      static_cast<double>(physical_size_pixels.width()),
      static_cast<double>(dpi_),
      static_cast<double>(desired_dpi));
    if (landscape) {
      double temp = page_measurements.page_length;
      page_measurements.page_length = page_measurements.page_width;
      page_measurements.page_width = temp;
    }

  }


Is it intentional that CEF only supports landscape mode when using a custom paper size? It seems like it may be a bug, but perhaps I'm missing something here.

Thanks,

Emerick
Last edited by emerick on Fri Jan 14, 2011 1:19 pm, edited 1 time in total.
emerick
Expert
 
Posts: 154
Joined: Sun Feb 21, 2010 7:57 pm
Location: Belmont, MA

Re: Page orientation only respected when usin custom paper sizes

Postby magreenblatt » Wed Jan 12, 2011 11:49 am

Hi Emerick,

Landscape orientation should work with any paper size. Please create an issue in the issue tracker and provide a patch for what you think is the correct fix.

Thanks,
Marshall
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Page orientation only respected when using custom paper size

Postby emerick » Fri Jan 14, 2011 1:27 pm

Hi Marshall,

I created issue 171 to track this (http://code.google.com/p/chromiumembedd ... ail?id=171). I haven't attached a patch yet, as my first attempt at fixing this (by ensuring that we respect page orientation for non-custom sizes) still resulted in a printout that was in portrait mode! I guess there is another issue at work here. I'll continue to look into this and report back with what I find.

Thanks,

Emerick
emerick
Expert
 
Posts: 154
Joined: Sun Feb 21, 2010 7:57 pm
Location: Belmont, MA


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 74 guests