0
PDF를 생성하는 앱을 개발 중입니다. PDF를 생성 할 수는 있지만 PDF를 작성하고 저장하는 원 클릭 액션입니다. 제가하고 싶은 것은 PDF의 미리보기를 보여준 다음 그것을 편집하거나 문서 폴더에 저장하는 옵션으로 변경하는 것입니다. 어떻게이 일을 할 수 있습니까? 여기 내가 그것을 지키는 것이 있습니다.iOS에서 PDF 문서 미리보기 저장하기 전에
- (IBAction)generatePdfButtonPressed:(id)sender
{
pageSize = CGSizeMake(792, 612);
NSString *fileName = @"Demo.pdf";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName];
[self generatePdfWithFilePath:pdfFileName];
}
- (void) generatePdfWithFilePath: (NSString *)thefilePath
{
UIGraphicsBeginPDFContextToFile(thefilePath, CGRectZero, nil);
BOOL done = NO;
do
{
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, pageSize.width, pageSize.height), nil);
[self drawImage];
[self drawText];
[self drawText2];
[self drawText3];
[self drawText4];
done = YES;
}
while (!done);
// Close the PDF context and write the contents out.
UIGraphicsEndPDFContext();
}
내 문제는 PDF를 저장하기 전에 미리 볼 필요가 있다는 것입니다. 귀하의 제안은 PDF를 저장하고 표시합니다. 나는 어떤 문서도 먼저 저장되지 않도록 미리보기 옵션을 원합니다. – user717452
저장에 반대하는 특별한 이유가 있습니까? 사용자가 더 이상 취소하거나 원하지 않는 경우 웹보기에서 문서를로드하는 대신 – Stephen
문서를 삭제하면 uiwebview에 데이터가로드되어 미리보기가됩니다. –