Document Creation and Exporting as PDF

Greetings,

I wanted to ask if there is a way to do some kind of form filling on the IOS , preferably to be used on iPad Pro, so to have the ability to sign the document as well with the apple pencil, then once document is finished to be saved as PDF and saved on a database as Blob and sent as well via email.

So my questions are :

  1. Is there a way to create reports for IOS apps ?
  2. Those reports can be saved as PDF ?
  3. Is there a way to use the apple pencil for digital signature or should i use a canvas and draw on it, then export the canvas as picture and put it in the report .

Thank you in advance.

Aurelian.

The solution I have used for this is to generate HTML on the iPad and send the HTML to a server that has wkhtmltopdf or phantomjs running in the background.

Those two services will generate a PDF file using HTML as the input.

Thanks for that but unfortunately i dont have access to the outside as it is one inside project and i dont have access to any apps other than the ones on the ipad.

I noticed that on Numbers on the iphone you have an option share and then it asks you on which format you should use it if you want to send it by mail, then you have Numbers , PDF, Excel, CSV so i guess they do have some magic in the app there and it can be done via phone side,i will try to dig into the apple dev forum if they have something related to that .

Thanks again.

[quote=333314:@jean-paul devulder]Want free soluce or paid ?

Some tools can be ported to Xojo, but need some time and not sure have a market for that ;)[/quote]
Well depends what does that mean, if its a reasonable price then i dont mind paying for it .

I`ll check as well what there is out there and update the thread, let me know if you have something.

Thanks.

Any updates on this ? it seems that nobody is interested to much in IOS and improving XOJO for this side.

You can convert HTML to PDF using http://phantomjscloud.com API

The API includes 500 pages/day for free.
The app will need to have network connectivity to use the API.

PDF is “Xojo for iOS” should be “easy”… depending on how “Xojo for iOS” handles normal printing… if they use a CGContext then its just a matter of using a specific subclass, the rest of the commands remain the same (kind of like my gPDF class for Desktop)

Hello Dave,

Well so far I did not found a functional working solution to it, as for Jeremie Leroy I specified multiple times, if not then I doit now again, due to the data content Im not allowed to share that data nowhere the internet so Im obliged to have it locally . In the end I could have a server running on a Mac with luna for example and use https://wkhtmltopdf.org for exporting and do some things with the html to export the doc, which is my second option as for the last few months no luck with iOS only but again I would prefer to have something local.

Thanks again .

Here is a thought.
If you can use an iOS sharing panel to share the document, then it is possible to use that to print to pdf.
I haven’t tried it, but a google search brings this to my attention:
http://osxdaily.com/2017/03/13/print-to-pdf-iphone-3d-touch/
https://9to5mac.com/2016/09/18/how-to-print-to-pdf-from-iphone-and-ipad-ios-10/
Hope that helps

If you get it to work, would appreciate pointers on how to write code to do it.

Or maybe one of the following pdf apps from Readdle could be used?
https://itunes.apple.com/au/app/pdf-expert-by-readdle/id743974925?mt=8

I found this link that may be helpful

https://9to5mac.com/2018/03/23/how-to-save-annotate-webpages-as-pdfs-iphone-ipad/

This might help:
https://www.jeremieleroy.com/download-xcHTML2PDF

Uses native functions, no network needed, no data is sent outside of the iPhone.

25€ for full source-code

Can some one educated me as to why a simple method using the iOS PDF context cannot be created?
Its basically the same as a CGContext, but with a few more parameters (pagesize etc)

WARNING… THE BELOW CODE IS “NOT” XOJO CODE, AND IS FOR ILLUSTRATION PURPOSES ONLY

let pageSize = CGSize(width: 792,height: 612) 
UIGraphicsBeginPDFContextToFile(pdfPATH, CGRect.zero, nil)
UIGraphicsBeginPDFPageWithInfo(CGRect(x: 0, y: 0, width: pageSize.width, height: pageSize.height), nil)
let pdfContext : CGContext = UIGraphicsGetCurrentContext()!

      ...... DRAW PDF CONTENT ..... [just like you would for CGContext]

UIGraphicsEndPDFContext() // CLOSE PDF Document

I would think it would just be a slightly different initiation of what Xojo calls a “CANVAS”

I found that adding a sharing panel to the view in iOS, with button to activate it allows ‘printing’ to Notes, Mail, iMessage and social media, including Whats App if installed, or to a text document (without formatting)
The open action of the button should have something like:

SharingPanel1.ShareText(TextArea.text, Self, Me), where the TextArea is Text.

Once stored in Notes, there is an additional option available to save to a .pdf file, retaining the formatting seen in the note.

These actions are part of the newer iOS. It would be cool if Xojo could tap into the features, as Dave suggests.
I don’t know enough about declares to work it out, but perhaps we should be taking another look at the apple version of the sharing panel? It seems to have additional functionality now.

Also, worth taking a look at the link Jeremie has posted. It looks like he has done something along these lines.

Are you using the iOSSharing panel or the sharing panel (UIActionController) from iOSKit? The later is more fully featured if that is what you are looking for…

Just the one available in the Library - it says iOSSharing panel in the expansion when it is highlighted.
I giess I would like to learn how to use the sharing panel (UIActionController) from iOSKit

HI Jeremie
about this
This might help:
https://www.jeremieleroy.com/download-xcHTML2PDF

Uses native functions, no network needed, no data is sent outside of the iPhone.

25€ for full source-code

this works for make pdf and print if it works I pay the 25€ for full source-code and what another lib I need

I have some app I need to make for iPad and iPhone but 85% need to print
thanks

xcHTML2PDF actually needs to be updated for Xojo 2018r3+

I will update it in the next two hours and post an update message here.

Here’s another way to create PDFs from HTML: https://campsoftware.com/products/htmlpdfer.php

It uses https://wkhtmltopdf.org/ to do the conversions.

xcHTML2PDF is now updated for Xojo 2018r3 +

https://www.jeremieleroy.com/download-xcHTML2PDF

[quote=426287:@Jeremie Leroy]xcHTML2PDF is now updated for Xojo 2018r3 +

https://www.jeremieleroy.com/download-xcHTML2PDF[/quote]
AppIcon is missing from the project ?