iOS Print

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

michelle300
Posts: 5
Joined: Fri Mar 18, 2011 1:36 am

iOS Print

Post by michelle300 » Sat Mar 03, 2012 6:43 pm

I am having problems with using the print to pds function. I have PDF
Printing selected in the iOS Standalone Application Settings. This is
the test script I have in the print button:

on mouseUp
open printing to pdf "mypdf.pdf"
print this card
close printing
end mouseUp

This is from the dictionary. Nothing happens. Is the filename
"mypdf.pdf" a generic filename, or do I need to save and give a custom
name first? I have been through both the User Manual, iOS Release Notes, Dictionary and Forum.

How is Air Print handled? Is the external required?

I will appreciate any help.

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: iOS Print

Post by seaniepie » Sun Mar 04, 2012 12:56 am

Hi Michelle,

Download the latest 5.5 rreHardcopy sample externals if you haven't already :
http://www.runrev.com/developers/docume ... rnals-sdk/
The builds attached are for iOS5. rename the dylib in the Hardcopy/binaries folder to just "rrehardcopy.dylib". It won't work in the simulator, only on a real device.

You can then use something like:
put specialFolderPath("Documents") & "/tempPrint.pdf" into tPDFFile
rreHardcopyPrintPDF tPDFFile,"iOS Print"

Make sure you have PDF Printing checked in the iOS Standalone settings

All the best
Pi

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: iOS Print

Post by CALL-151 » Mon Mar 05, 2012 5:59 pm

As of LC 5.0.2 PDF printing works unless you have graphics effects applied to objects on the card you want to print. You do not need an external (AirPrint does require an external). It works in the simulator also.Your code should work using any legal filename you want for the pdf. You need to tell LC which directory to save your PDF to by either specifying a complete path or setting the default path. Your code as written will save the PDF to the default folder.

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: iOS Print

Post by Klaus » Mon Mar 05, 2012 6:15 pm

Hi michelle300 (wow, that's a lot :) ),
michelle300 wrote:on mouseUp
open printing to pdf "mypdf.pdf"
print this card
close printing
end mouseUp

This is from the dictionary. Nothing happens. Is the filename
"mypdf.pdf" a generic filename, or do I need to save and give a custom
name first?
yes, that is just an example name!

I think you need to add a valid filename like this:

Code: Select all

on mouseUp 
    ## we are allowed to write here:
    put specialfolderpath("documents") & "/Name of your pdf here.pdf" into tPrintPDF
    open printing to pdf tPrintPDF
    print this card 
    close printing 

  ## Check if file has been created, optional :-)
   answer (there is a file tPrintPDF)

  ## Will be TRUE on success, FALSE otherwise
end mouseUp
Best

Klaus

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: iOS Print

Post by monte » Mon Mar 05, 2012 8:44 pm

FYI I have a new external coming soon on mergExt which will allow you to present the standard iOS modal screens, action sheets and popovers to preview documents, send them to other apps, print etc. You can also get the icon for a doc too.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: iOS Print

Post by CALL-151 » Tue Mar 06, 2012 12:30 am

Monte, you are the iOS external king! Those additions to your already strong suite will be fantastic. Since it seems you can churn these out in your sleep, how about AES256 encryption for those docs that are being sent to other apps. The RunRev team seem to be having problems porting encrypt/decrypt to iOS.

michelle300
Posts: 5
Joined: Fri Mar 18, 2011 1:36 am

Re: iOS Print

Post by michelle300 » Tue Mar 06, 2012 2:29 am

Thanks so much for everyones help!

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: iOS Print

Post by monte » Tue Mar 06, 2012 3:15 am

I'm trying to stay clear of RunRev's obvious roadmap of porting what works on desktop onto mobile but can you give me more detail. I've already added the file protection to mergXattr. If the file is encrypted the app at the other end won't be able to open it. Maybe you want a custom url protocol with encrypted parameters to move data around your own apps?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: iOS Print

Post by gpb01 » Tue Mar 06, 2012 12:46 pm

CALL-151 wrote:... Since it seems you can churn these out in your sleep, how about AES256 encryption for those docs that are being sent to other apps. The RunRev team seem to be having problems porting encrypt/decrypt to iOS.
Be careful using encription on iOS ...
... read here : http://blog.theanimail.com/iphone-encry ... e-for-apps and here : http://blog.theanimail.com/iphone-encry ... for-apps-0

Using encription on iOS can put you in a veeery long approval process ... ;)

Guglielmo

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: iOS Print

Post by CALL-151 » Tue Mar 06, 2012 2:19 pm

Understood, but for medical apps in the US there's no option. All identifying info must be encrypted with AES-128 or better. This is built into the hardware, but once unlocked files will be sent in the clear unless the app that "owns" then encrypts.

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: iOS Print

Post by CALL-151 » Tue Mar 06, 2012 2:39 pm

monte wrote:I'm trying to stay clear of RunRev's obvious roadmap of porting what works on desktop onto mobile but can you give me more detail. I've already added the file protection to mergXattr. If the file is encrypted the app at the other end won't be able to open it. Maybe you want a custom url protocol with encrypted parameters to move data around your own apps?
This is a confusing situation with conflicting info, but here's my understanding. Enabling protection ensures that files are hardware encrypted with AES-256, but they are decrypted on the fly as soon as the device is unlocked. This prevents someone from extracting data from a stolen device, but does nothing to protect data sent via email, from app to app, etc.

In early January I spoke to RunRev about this. They confirmed that they do intend to bring encryption to mobile, but that they were having issues with compatibility of the mobile versions of the SSL library that they use on the desktop, requiring significant changes to the engine and standalone builder.

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: iOS Print

Post by gpb01 » Tue Mar 06, 2012 3:57 pm

Hi CALL-151,
I never tried, but have you verified if the LIBRC4 of Mark Smith can be used or adapted on iOS ?

I read that Mark is no more with us ... but the web page, full of nice libraries, is still there : http://marksmith.on-rev.com/revstuff/

Guglielmo

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: iOS Print

Post by CALL-151 » Tue Mar 06, 2012 5:35 pm

Unfortunately, as I understand the requirements RC4 is not FIPS 140-2 validated, which means that it does not meet US requirements for protecting health information. The minimum seems to be AES-128 with a 10-bit key.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: iOS Print

Post by monte » Tue Mar 06, 2012 8:22 pm

I could implement this fairly quickly for you using this https://github.com/dev5tec/FBEncryptor
You would get a function to encrypt a string and return it base64encoded and one that does the reverse.

Given its so clearly on the run rev roadmap it might not be a good fit for my half price deal though. Contact me off list if you want to discuss it some more.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: iOS Print

Post by CALL-151 » Tue Mar 06, 2012 8:37 pm

monte wrote:Given its so clearly on the run rev roadmap it might not be a good fit for my half price deal though. Contact me off list if you want to discuss it some more.
I see your point. RR support said they hope to have a beta by sometime this summer, although I suspect it will take longer. You might want to offer an external soln directly to them. Perhaps they'd be relieved to have a viable option, even in the interim.

Post Reply