ios - Wrong paper size in AirPrint -


in app, different photo sizes can printed. working fine, ios 8 paper size letter/a4 if print dialog display e.g.. 5"x7". if user selects paper size again, paper size changes e.g. 5"x7".

does have same problem?

is there workaround?

here code:

 - (uiprintpaper *)printinteractioncontroller:(uiprintinteractioncontroller *)printinteractioncontroller choosepaper:(nsarray *)paperlist   {     cgsize pagesize = ((pppage *)[document.pages objectatindex:0]).papersize;      if (pagesize.width > pagesize.height) {         float w = pagesize.width;         pagesize.width = pagesize.height;         pagesize.height = w;     }     nslog(@"printinteractioncontroller:choosepaper: needed pagesize = (%.1f,%.1f)",pagesize.width,pagesize.height);     uiprintpaper *retpaper = [uiprintpaper bestpaperforpagesize:pagesize withpapersfromarray:paperlist];     nslog(@"printinteractioncontroller:choosepaper: chosen uiprintpaper = (%.1f,%.1f)",retpaper.papersize.width,retpaper.papersize.height);      return retpaper; } 

and log output:

2015-06-19 12:22:53.474 photoprint[5955:1225053] printinteractioncontroller:choosepaper: needed pagesize = (288.0,432.0) 2015-06-19 12:22:54.118 photoprint[5955:1225053] printinteractioncontroller:choosepaper: chosen uiprintpaper = (612.0,792.0) 2015-06-19 12:22:54.118 photoprint[5955:1225053] -[pkpaperlist matchedpaper:preferborderless:withduplexmode:didmatch:] papertomatch= result= matchtype=0 2015-06-19 12:23:06.351 photoprint[5955:1225053]

--> wrong paper size letter selected!


now select paper again:

printinteractioncontroller:choosepaper: needed pagesize = (288.0,432.0) 2015-06-19 12:23:14.860 photoprint[5955:1225053] printinteractioncontroller:choosepaper: chosen uiprintpaper = (360.0,504.0) 2015-06-19 12:23:14.860 photoprint[5955:1225053] -[pkpaperlist matchedpaper:preferborderless:withduplexmode:didmatch:] papertomatch= result= matchtype=0

--> time correct paper size.

your code appears swapping width , height -- seems attempting change orientation of print. that's not way it: set orientation, see uiprintinfo.orientation

as why different results, i'm not sure assume bestpaperforpage size can affected selected printer's offline/online state (ie. if call bestpaperforpage before printer has ever been contacted, default a4 unless have chosen photo print type). if want default 4x6 use uiprintinfooutputphoto on uiprintinfo


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -