Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6681523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:35:59+00:00 2026-05-26T04:35:59+00:00

I am printing out a UIImage using AirPrint but the margins aren’t correct. This

  • 0

I am printing out a UIImage using AirPrint but the margins aren’t correct. This is what it looks like when it prints:
Photo of printout

Is there a way I can make it fit perfectly on the paper?

Here’s the code as requested:

    UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
    //pic.delegate = del;

    UIPrintInfo *printInfo = [UIPrintInfo printInfo];
    printInfo.outputType = UIPrintInfoOutputGeneral;
    printInfo.jobName = [NSString stringWithFormat:@"New Ticket"];
    pic.printInfo = printInfo;


    pic.printingItem = [UIImage imageWithContentsOfFile:path];

    void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
    ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
        if (!completed && error) {
            UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Error." 
                                                   message:[NSString stringWithFormat:@"An error occured while printing: %@", error]
                                                  delegate:nil 
                                         cancelButtonTitle:@"OK" 
                                         otherButtonTitles:nil, nil];

            [av show];
            [av release];
        }
    };

    [pic presentAnimated:YES completionHandler:completionHandler];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:36:00+00:00Added an answer on May 26, 2026 at 4:36 am

    Your best bet is probably to scale the image down to the ratio of the printed image, that way you can see the whole thing on the page.

    There are several ways of doing this, so I will just tell you the way that I would do it. I maintain a class called ANImageBitmapRep that has several different types of image scaling. The kind of scaling that you want keeps the entire image, but centers it inside of a rectangle of a certain size. First, you must add the ANImageBitmapRep source files to your project, and #import ANImageBitmapRep.h:

    #import "ANImageBitmapRep.h"
    

    Then, scale the image like this:

    pic.printingItem = [[UIImage imageWithContentsOfFile:path] imageFittingFrame:CGSizeMake(478, 640)];
    

    You can change the CGSizeMake(x, y) to whatever you want, in order to adjust the scale and resolution of the scaled image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im printing out unordered lists dynamically..something like this $sql2 = mysql_query(SELECT id, todo FROM
I'm printing out some values from a script in my terminal window like this:
This script below is printing out the checkboxes but isn't plotting anything in the
Assume this is pretty easy but having a hard time printing out NodeSeq of
I have a linkedList using nodes. I have it printing out alphabetically but now
I'm building an XML document and printing out into an indented format using the
I am having some issues printing out the subarray homemain=>image This is my JSON
I successfully inserted some data into my sqlite database(I confirmed this by printing out
I'm printing out a table with line totals but I also want to get
I'm just starting out with Java, but my boss is pushing for this. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.