Display PDF on iPad

后端 未结 1 1457
粉色の甜心
粉色の甜心 2021-01-17 05:36

hi i am trying to print pdf,It is printing well but the problem is not fit the width for every pdf.my code is like this..

//for scalling
-(CGSize)getPageFitS         


        
1条回答
  •  一整个雨季
    2021-01-17 06:01

    There is a pretty easy way to get the rect of a PDF page,

    CGRect pdfPageRect = CGPDFPageGetBoxRect(CGPDFDocumentGetPage(myDocumentRef,pageNumber), kCGPDFMediaBox);

    Three things will effect the size of the drawn PDF:

    • CGContextTranslateCTM(ctx, 0.0, HEIGHT);//HEIGHT

    • CGContextConcatCTM(ctx, CGPDFPageGetDrawingTransform(p,kCGPDFCropBox,MY_RECT, 0,true));//MY_RECT

    • CALayer.tileSize

    The Scale can also be effected by the two numbers in this function: CGContextScaleCTM(ctx, 1, -1);

    0 讨论(0)
提交回复
热议问题