Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

Problem reloading PDF 7 years 5 months ago #11361

  • vicbor
  • vicbor's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 1
  • Thank you received: 0
Our client just purchased a license and we are currently trying to replace UIWebView with RadaeePDF to just view the PDFs. We have some legacy logic that modifies the PDF (not with Radaee) while it is being displayed so we need to reload it. This worked fine with the UIWebView but we can get the reload part to work with Radaee.

The behavior we are experiencing is the PDF not being redrawn until 10-20 seconds or until the user starts scrolling the view. It seems that the thread is waiting for a mutex to be released, but not sure why is the mutex locked.

This is the code that we use to load (and reload) the PDF:
    PDF_ERR err = 0;
    [m_view removeFromSuperview];
    [m_view vClose];
    m_doc = [[PDFDoc alloc] init];
    err = [m_doc open:path :pwd];
    CGRect rect = [[UIScreen mainScreen]bounds];
    m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height-20-44)];
    
    // Disable vertical & horizontal bouncing
    m_view.alwaysBounceVertical = NO;
    m_view.alwaysBounceHorizontal = NO;
    
    // Set delegate
    m_view.delegate = self;
    [m_view vOpen :m_doc :(id<PDFViewDelegate>)self];
    
    pagecount = [m_doc pageCount];
    [self.pdfArea addSubview:m_view];
    [m_view vSetPos:&previousPosition];

Basically the notify_render method is not called immediately but instead after 10 seconds or as soon as the user starts scrolling.

Previously we were reusing the view but then, as you can see, we tried to recreate it completely just to see if it solved the issue.

We have tried calling vRenderAsync and vRenderSync without success. We also tried calling PDFView refresh method in order to trigger UIVIew setNeedsDsplay with no luck either.

Is there any way to force the redraw or a better approach to what we are trying to do?

Thanks

Please Log in or Create an account to join the conversation.

Last edit: by vicbor.

Problem reloading PDF 7 years 5 months ago #11363

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

if I understood correctly, you have an opened pdf file and in another process you modified it and you want to reload it.
I tried with this sample method in RDPDFViewController and it seems to work correctly:
- (void)refreshPdf
{
//get the current page
    int page = [m_view vGetCurrentPage];
//close the pdf file and reset the m_doc and m_view
    [self PDFClose];
//reopen the pdf file
    [self PDFOpen:samePdfPath :@""];
//go to current page
    [self PDFGoto:page];
}

Please Log in or Create an account to join the conversation.

Problem reloading PDF 7 years 5 months ago #11364

  • tonygd
  • tonygd's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
I have taken a look on this codes but it takes some time to reload like 10 - 20 seconds.
So I did some debugging and i found that after 10-20 seconds after refresh function that you gave, it called this below function

-(void)OnPageRendered:(PDFVCache *)cache{
[self refresh];
}


Can you give us a refresh function that refresh immediately ? Not like this, or did I setup something wrong ?

Please Log in or Create an account to join the conversation.

Problem reloading PDF 7 years 5 months ago #11367

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

it's possible that you are calling that method in a background thread?
Have you tried to force it on main thread?

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum