i have a ViewController_A with a button_A. this button shows me the ViewController_B. this second view controller has content and a button_B.
i you press the button_b the following code will create a pdf file of the ViewController_B content:
let pdfData = contentVC_B.dataWithPDF(inside: contentVC_B.frame)
let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false).appendingPathComponent("test.pdf")
do {
try pdfData.write(to: fileURL, options: .atomic)
} catch {
print(error)
}
This works fine. But now my question:
i would like to create a pdf file of the ViewController_B content with button_A (from the ViewController_A) without showing the ViewController_B.
is is possible? if yes, how can i realize it?