PDFGenerator
PDFGenerator copied to clipboard
UIView moves after rendering pdf
After I execute rendering code on my UIView, this view itself moves to (0,0) from (centerX,centerY). Code is executed on an IBAction, button pressed.
pdf = renderFPL()
func renderFPL() -> Data?{
let v1 = self.fplContainer!
let dst = URL(fileURLWithPath: NSTemporaryDirectory().appending("sample1.pdf"))
do {
let data = try PDFGenerator.generated(by: [v1])
try data.write(to: dst, options: .atomic)
return data
} catch (let error) {
print(error)
}
return nil
}
Found any solution for this ? @Oscar053
The solution was to set constraints by code after the rendering. It's a workaround but it works.
how to share pdf file from UIwebview?
i have this issue too
Hey, in case it's still needed I was able to solve that problem. I put in '.translatesAutoresizingMaskIntoConstraints = true' and that fixed it for me. Everything stays in its position.
Hey, in case it's still needed I was able to solve that problem. I put in '.translatesAutoresizingMaskIntoConstraints = true' and that fixed it for me. Everything stays in its position.
It helped somewhat but not 100%. thanks