0
我想提出一個PDF的應用程序中,我得到的問題初學者在iphone,製作PDF,我在做什麼錯
// make pdf
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
BOOL isFileCreated;
if(isPortrait)
{
isFileCreated = UIGraphicsBeginPDFContextToFile([NSString stringWithFormat:@"%@/test.pdf",documentsDirectory],CGRectMake(self.m_ScrollView.frame.origin.x, self.m_ScrollView.frame.origin.y-340, self.m_ScrollView.frame.size.width, self.m_ScrollView.contentSize.height), nil);
}
else
{
isFileCreated = UIGraphicsBeginPDFContextToFile([NSString stringWithFormat:@"%@/test.pdf",documentsDirectory],CGRectMake(self.m_ScrollView.frame.origin.x, self.m_ScrollView.frame.origin.y-250, self.m_ScrollView.frame.size.width, self.m_ScrollView.contentSize.height), nil);
}
if(isFileCreated)
{
UIGraphicsBeginPDFPage();
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndPDFContext();
}
此代碼創建只有一半的PDF。目前顯示在屏幕上,其餘的pdf缺失,目前沒有在屏幕上顯示。我該怎麼辦? 在此先感謝。
我在這裏使用UIGraphicsGetCurrentContext()方法。我認爲它只呈現當前顯示區域。有沒有辦法渲染所有的視圖。 – Bond 2012-03-27 13:24:59