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

  • Home
  • SEARCH
  • 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 588901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:22:03+00:00 2026-05-13T15:22:03+00:00

I’ve a problem with drawing images on PDF. I do apply scaling, rotation, move,

  • 0

I’ve a problem with drawing images on PDF. I do apply scaling, rotation, move, etc. to an image and draws that image on the PDF. But drawing is not outputting correctly. When I do rotate image, it just scales and doesn’t rotate.

Here, I explain in more detail:
I place an image on UIWebView to make fake effect of image exactly on PDF. Then, I do draw image on PDF which is on the UIWebView while making PDF.

But when I go and prepare PDF with modified image, which has been applied lots of transformations, image scales not rotates.

Here, img_copyright is a Custom class inheriting UIImageView.

CGFloat orgY = (newY-whiteSpace)+img_copyright.frame.size.height;
CGFloat modY = pageRect.size.height-orgY;

CGFloat orgX = img_copyright.frame.origin.x-PDF_PAGE_PADDING_WIDTH;
CGFloat modX = orgX;

//We're getting X,Y of the image here to decide where to put the image on PDF.


CGRect drawRect = CGRectMake (modX, modY, img_copyright.frame.size.width, img_copyright.frame.size.height);

//Preparing the rectangle in which image is to be drawn.


CGContextDrawImage(pdfContext, drawRect, [img_copyright.image CGImage]);
    [img_copyright release];

// Actually drawing the image.

But when i see the PDF image is not properly drawn into it.

What would you suggest, is it the problem due to image drawing based on its X,Y?
How could we decide where to put the image on PDF if we don’t depend on X, Y?
What is the exact method of drawing image on PDF with rotation, scale?

The Image when I do insert the image onto UIWebView’s scrollbar.
http://www.freeimagehosting.net/”>

The Image when I do draw the image onto PDF.
http://www.freeimagehosting.net/”>

  • 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-13T15:22:03+00:00Added an answer on May 13, 2026 at 3:22 pm
    CGFloat angleInRadians =-1*Angle* (M_PI / 180.0);
    CGAffineTransform transform=CGAffineTransformIdentity;
    
    transform = CGAffineTransformMakeRotation(angleInRadians);
    //transform = CGAffineTransformMakeScale(1, -1);
    //transform =CGAffineTransformMakeTranslation(0,80);
    
    CGRect rotatedRect = CGRectApplyAffineTransform(CGRectMake(0,0,Image.size.width,Image.size.height), transform);
    
     UIGraphicsBeginImageContext(rotatedRect.size);
     //[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
     CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0,rotatedRect.size.height);
     CGContextScaleCTM(UIGraphicsGetCurrentContext(),1, -1); 
    
     //CGContextTranslateCTM(UIGraphicsGetCurrentContext(), +(rotatedRect.size.width/2),+(rotatedRect.size.height/2));
    
     CGContextTranslateCTM(UIGraphicsGetCurrentContext(), (rotatedRect.origin.x)*-1,(rotatedRect.origin.y)*-1);
     CGContextRotateCTM(UIGraphicsGetCurrentContext(), angleInRadians);
     //CGContextTranslateCTM(UIGraphicsGetCurrentContext(), -(rotatedRect.size.width/2),-(rotatedRect.size.height/2));
    
     CGImageRef temp = [Image CGImage];
    
     CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, Image.size.width,Image.size.height), temp);
    
     //CGContextRotateCTM(UIGraphicsGetCurrentContext(), -angleInRadians);
     UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
     UIGraphicsEndImageContext();
    
     return viewImage;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.