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 8109715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:30:21+00:00 2026-06-06T01:30:21+00:00

I have an annotated PDF and want to convert it to image. The pdf

  • 0

I have an annotated PDF and want to convert it to image. The pdf is successfully getting converted to an image but annotations are missing in the conversion.

This is the code:

NSPDFImageRep *img = [NSPDFImageRep imageRepWithContentsOfFile:PdfFilePath];
NSFileManager *fileManager = [NSFileManager defaultManager];

[img setCurrentPage:0];

NSImage *temp = [[NSImage alloc] init]; 
[temp addRepresentation:img]; 
NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:[temp TIFFRepresentation]]; 
NSData *finalData = [rep representationUsingType:NSJPEGFileType properties:nil]; 
NSString *pageName = [NSString stringWithFormat:@"Page1_%d.jpeg", 0]; 
NSString *imgFilePath = [NSString stringWithFormat:@"%@/%@",@"/Users/Desktop/PDFImages", pageName];
[fileManager createFileAtPath:imgFilePath contents:finalData attributes:nil];

Is there a different way to store the annotated pdf to image?

  • 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-06-06T01:30:23+00:00Added an answer on June 6, 2026 at 1:30 am

    The issue is resolved using image lock and unlock feature.

         NSSize     pageBounds1;
        pageBounds1 = [page1 boundsForBox: [_pdfView displayBox]].size;
        NSImage *temp = [[NSImage alloc] initWithSize:pageBounds1];
    
        [temp lockFocus];
        [page1 drawWithBox:kPDFDisplayBoxMediaBox];
        [temp unlockFocus];
    
        NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:[temp TIFFRepresentation]]; 
        NSData *finalData = [rep representationUsingType:NSJPEGFileType properties:nil]; 
        NSString *pageName = [NSString stringWithFormat:@"Page1_%d.jpg", pageIndex]; 
        NSString *imgFilePath = [NSString stringWithFormat:@"%@/%@",pathForImages, pageName];
        [fileManager createFileAtPath:imgFilePath contents:finalData attributes:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have annotated my classes with @Repository, @Resource, @Component, @Service annotations but these classes
I have a method annotated with @PrePersist annotation but I've seen that when this
This is probably unbelievably basic. In the code below, I have annotated the part
I have a bunch of annotated, interrelated POJOs that I want to create/modify/search over
I have a class this is annotated with @Path like so: @Path(widgets) @Produces(MediaType.APPLICATION_XML) public
some methods in our model pojos have been annotated like this: @Column(name=cli_clipping_id, updatable=false, columnDefinition
Is there an easy way to do this. I have some classes annotated with
Imagine I have this annotated method in a Spring 3 @Controller @RequestMapping() public @ResponseBody
I have a method annotated with @Provides in my Guice config, but it doesn't
I'm using Hibernate 3.6 and have my code annotated (versus using hibernate mapping files).

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.