High quality UIImage from PDF

后端 未结 6 1349
我寻月下人不归
我寻月下人不归 2020-12-14 03:57

I\'m converting a PDF page into a UIImage. While doing so, I lose the image quality. Need help in getting high quality images.

Code to generate UIImage

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 04:26

    When you ask the PDF for it's page size, you're getting a width/height for 72 PPI. You might try creating a context that's scaled up using a scale transform. For example, if you wanted to render at 300 dpi, add a scale transform to scale by 300.0/72.0.

    If you export as TIFF, you will be able to encapsulate the final PPI (300) of the generated image.

提交回复
热议问题