TPPDF icon indicating copy to clipboard operation
TPPDF copied to clipboard

How to add UIView?

Open CodeSales opened this issue 2 years ago • 1 comments

Hello, I have a question that I would like to ask, please help to answer if it is convenient, thank you.

I want to add a UIView inside a PDF, this UIView has some UILabel on it. I saw that there is no method for adding UIView in the interface, so I converted UIView into UIImage and added it. But then the text of the UILabel on the UIView is very blurry. Please help to see how to solve it, thank you.

CodeSales avatar Aug 03 '22 15:08 CodeSales

Hi there,

TPPDF does not support rendering an UIView into an PDF, as it does not rely on UIKit or AppKit anymore, but mostly on CoreGraphics instead, and also because it uses building blocks instead of UI elements.

Rendering the UIView into an image, and then adding the UIImage is the best way to do it. If your UILabel is blurry, you might need to set a larger scale on the UIView before rendering.

Please provide a small reproducible example, so we can see how you approach it.

philprime avatar Aug 04 '22 08:08 philprime

Thanks, I've solved the problem.

CodeSales avatar Nov 24 '22 02:11 CodeSales

Thanks, I've solved the problem.

can you tell me how you solved it?

kaaaaai avatar Mar 17 '23 07:03 kaaaaai