0

I am making an enterprise app using ResearchKit.

I am now in the step of making a pdf with the answers gathered and emailing it.

I know that if you have a Consent Document this is the code for it:

ConsentDocument .makePDFWithCompletionHandler({ (NSData pdfFile, NSError error) -> Void in

        // println("pdf created")

        // finding document path  //TODO: Remove if not needed

        let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] .stringByAppendingPathComponent("Consent.pdf")

        pdfFile!.writeToFile(documentsPath, atomically: false)

        println(consentDocumentFromDirectory)

    })

But what if I do not have a Consent Document?

How should I create the pdf?

asheyla
  • 3,175
  • 5
  • 18
  • 34

1 Answers1

0

Unfortunately, ResearchKit doesn't currently support HTML or PDF output for regular question steps. After finishing a task, you'll need to manually and recursively process ORKTaskResult and convert them to a suitable format of your choice.


There's an ongoing GitHub Issue discussing the possibility of adding printing support (as HTML output) to ResearchKit, which is exactly what you'd need.

If this is done, converting such HTML output into a PDF file would be trivial. However, I'm afraid that progress on this issue seems to have stalled recently and I'm not sure if anybody is currently working on it.

Ricardo Sanchez-Saez
  • 9,466
  • 8
  • 53
  • 92