Hi
I have just updated my app to the latest version of PDFTron (6.1.0). I am having trouble with an editable form. I am able to open the form succesffully, however, when I edit one field then tap into another field to carry on editing I get a crash in FormFillTool.m => didEndEditing on the following line: Widget* wg4 = [[Widget alloc] initWithAnn:m_moving_annotation]; (line 901 in the file). The error I get is a EXC_BAD_ACCESS.
I have tried the same thing with one of the forms in the sample app in my app and all works out fine. I have tried putting my form in the sample app and all works fine, so I am not sure what it is I may be doing wrong. The one fundamental difference is that my app uses arc whilst the sample does not, I am not sure if this has something to do with it…
Here is the code I am using to initialise the pdfViewCtl.
- (void)viewDidLoad
{
[super viewDidLoad];
[PDFNet Initialize:kPDFTronLicenceKey];
NSString* resourcePath = [[NSBundle mainBundle] pathForResource:@“pdfnet” ofType:@“res”];
[PDFNet SetResourcesPath:resourcePath];
[PDFNet SetDefaultDiskCachingEnabled:YES];
[self setPdfViewCtrl:[[PDFViewCtrl alloc] initWithFrame:self.view.bounds]];
// [pdfViewCtrl SetPathHinting:YES];
[pdfViewCtrl setDelegate:self];
// [pdfViewCtrl SetImageSmoothing:NO];
// [pdfViewCtrl SetOverprint:e_op_off];
@try {
NSLog(@“size: %d”, [currentDocument.file.data length]);
[self setDocToOpen:[[PDFDoc alloc] initWithBuf:currentDocument.file.data buf_size:[currentDocument.file.data length]]];
}
@catch (NSException *exception) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@“Exception” message:[exception reason] delegate:self cancelButtonTitle:@“Ok” otherButtonTitles:nil , nil];
[alert show];
return;
}
if( [[self docToOpen] InitStdSecurityHandlerWithPassword:@"" password_sz:0] == NO )
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@“Oh Noes!” message:@“This file is password protected :(” delegate:self cancelButtonTitle:@“Ok” otherButtonTitles:nil , nil];
[alert show];
return;
}
[pdfViewCtrl SetProgressiveRendering:YES withInitialDelay:0 withInterval:750];
[pdfViewCtrl SetHighlightFields:YES];
[pdfViewCtrl SetRenderedContentBufferSize:100];
[pdfViewCtrl SetZoomLimits:e_trn_zoom_limit_absolute Minimum:0.5 Maxiumum:10];
[pdfViewCtrl SetPageViewMode:e_trn_fit_width];
[pdfViewCtrl SetBackgroundColor:255 g:255 b:255 a:0];
[pdfViewCtrl SetDoc:[self docToOpen]];
[self.view addSubview:[self pdfViewCtrl]];
[self.view setBackgroundColor:[UIColor scrollViewTexturedBackgroundColor]];
[pdfViewCtrl setTool:[[PanTool alloc] initWithPDFViewCtrl:[self pdfViewCtrl]]];
}
Any pointers would be appreciated as I just can’t seem to figure out what I may have done wrong.
Thanks
Bradley