Print PDF file on iphone or ipad

后端 未结 4 1465
北海茫月
北海茫月 2021-02-20 14:47

I attached a file to the mail I am using this code.

[mail addAttachmentData:[myView PDFData] mimeType:@\"application/pdf\" fileName:@\"name.pdf\"];
4条回答
  •  花落未央
    2021-02-20 15:11

    You should read through the Drawing and Printing Guide for iOS. The printingItem property of UIPrintInteractionController can be set to the NSData of a PDF.

    Update for added code

    The value of dataFromPath should be equal to [myView PDFData] although I would recommend changing the variable name once you get it working.

    NSData *dataFromPath = [myView PDFData];
    

提交回复
热议问题