Same as QLPreviewController but from NSData (without files)? - ios

I want to show a preview of a file with a QLPreviewController (or similar) without writing the file to disk (for security reasons). I want to pass the binary contents of the file directly to the controller. Is it possible?
Judging from QLPreviewController's code, it only takes URLs. Are there any alternatives?


How to reduce the jar size of a codename one app to stay under 50meg

My app is too large for the 50 meg limit so I am looking at some ways to significantly reduce the file size.
If I discard a dpi what happens when it runs on that dpi? I have some HUGE backgrounds making my app very bloated, I was wondering if I can remove them all but say the HD one and it would scale or would it be simply empty? Or would I need to change the background image scaling to make it do this?
Also CN1 seems to use png, can I use jpg for selected items to save space? Backgrounds that are 2.3 meg pngs could be 35k jpgs.. Even if I wrote a script that jpeged them after I press save in the gui designer, this could work I assume?
Any any further final tips for reducing the size of cn1 apps?
A 50mb app is not only big, but prone to be slow on devices (performance wise).
To reduce your App size tremendously, do the following:
All my answers are based on old GUI Builder
For background image, use a single image (not multi-image) and style the form UIID to use the image and type IMAGE_TO_FILL.
Avoid using png image whenever possible, CN1 supports jpg perfectly.
Don't use images for basic icons, use fonticon. Thousand of icons could be made 100kb and of high quality svg image that doesn't pixelate. I will explain at the end of this list how to create your custom fonticons.
Avoid using 9-piece border image where it's not really needed, try to use solid background color if it won't ruin your design.
Delete unused images, they also take a lot of space. On your GUI Builder.
Re-use UIIDs, instead of creating multiple similar UIIDs.
Migrate your GUI Builder forms to code, I posted a sample form Class to answer another question here and also talk about similar thing here.
Delete UIIDs you're not using and in most cases, copy and paste UUID of unselected style to selected, instead of creating similar.
Be Careful with this. Keep your GUI Builder open, make sure Xml team mode is checked under File, save the GUI Builder after deleting Unused Images, without closing the GUI Builder, go to your project folder -> res -> delete theme.xml and the theme folder inside res folder (The name might be different if you've renamed your theme.res file). Now go back to your app and save again. A fresh copy of your res files would be saved in the same folder.
Minimise the amount of background images you use, Modern good looking apps are simple plain background apps. E.g, Facebook, Twitter, Uber, AirBnB, BBC News App and many others. Unless your app is actually a game or necessarily require rich images that have to be static.
Watch this video about performance tuning, It's a bit old but still contains useful information
If your app is bigger than 20 mb on iOS and 5mb on android, you should be worried about it's performance.
Creating fonticons:
Go to and check the icons present, if there are icons you need that are not there...
Go to and search for it there, download it as svg and drag'n'drop the svg on fontello webpage. If the icon doesn't look as expected...
Go back to and download the image as black 512px png image and go to, convert the png to Monochrome svg file, this helps you to create a compound image that works well with fontello.
download the fonticon as zip on fontello and follow Shai's chat app example to use it. the zip contains demo html file to preview your icons and also a config.json that can be drag'n'drop on to continue where you stopped.

Compress Png Files missing from build settings

I am building an app which has quite a few images in, therefore I have crushed them all using ImageOptim to help decrease the size of my .IPA. How ever the size of my app has not changed at all.
I have looked on their website and they say to turn off Compress Png Files in the Build Settings under Packaging. However that option is not there. I have tried manually adding it into my project.pbxproj but it gets listed under the User Defined section and does not turn it off.
I have also tried searching in the Build settings (My main target is selected).
So my question is... how can I add Compress Png Files into my build settings?
It might sound mind blowing, but please read it to the very end.
Try dragging and dropping a dummy png file to your project
navigator, then select like "Add, Copy if Needed" and the option
will appear in the Packaging section. But, I guess, this is not your case.
It looks like you have all your png's contained in an asset catalog rather that just lying around. For that case, I guess, you might want to play around with this:
You need to Just Search in Build Setting png And CopyPNG File - Packaging is Searched And The Section Have Option is Compress Png File is The Default value is Yes You will change value NO it Means your png Files is Compressed Bellow is the Screen Shot
If you change the format of the file to png, the error shows up all the time for the assets when you try to use it. It's better to find the original png file or save the file as a png file with an image editor.

RTF support of UIWebView/QLPreviewController or iOS in general

The Technical Q&A QA1630 says that an UIWebView supports RTF-docments. Also the QLPreviewController should support RTF. Now I tried that and found the following out:
Footers/Headers are not supported at all
Positioning is different than e.g. in Word
Text font & size looks different than e.g. in Word
formatting marks are not hidden
images are not displayed
Also I noted that TextEdit on Mac also doesn't support this. Some of the points I can overcome, but I need the footers, headers and images. How would I get support for this or I'm doing something wrong? Are there alternative approaches?
I tried to use loadRequest (directly stored as file) instead of loadData (only in a variable). There is no difference. Also I tried the QLPreviewController with the same result. I also tried NSAttributedString as Apple stated
Show RTF files to the user is to use the Quick Look framework
(QLPreviewController) or to load an NSAttributedString from the RTF
file and show it in an UITextView, which will render the content in a
much cleaner way.
Here the plain text content of the rtf file was shown as expected.
How can I properly display a RTF-file with headers, footers and images?

Copy GIF data from clipboard with WinJS

I'm writing a WinJS app and it would be a nice feature to handle animated GIFs. After some research, if would seem that in order to do that, that the data is copied to the clipboard using the little know CF_GIF clipboard format
how to get animated gif image from browser clipboard api?
but looking over the WinJS documentation for clipboard formats
it doesn't seem like CF_GIF is available, and when I copy a GIF to the clipboard and look at dataPackageView with the command
var dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.getContent();
it just shows up as a bitmap. Can anyone tell me if it is indeed possible to get an animated GIF from the clipboard or some kind of work around?
CF_Bitmap is the way to go here.
You COULD make a private data format, and put the entire GIF on there. And you could paste it into other instances of your app. But it wouldn't work with anything else, unless you also provided it as CF_Bitmap.
OK, there's another way. You could dump to a .gif file, then place the CF_HDROP (file pointer) onto the clipboard. Then when you paste, it's like pasting a file from windows explorer. That may work for some apps.
Yeah, like I said, use CF_Bitmap.

Exporting embedded Adobe PDF Reader text

I have an embedded Adobe PDF Reader in my Windows application. When I open a certain PDF file I need to do is manually select a text in that PDF and transfer it over to a textbox. I haven't done much work with PDF embedded components. But I can see two potential solutions. Either to find where in embedded component selected text can be grabbed from or use a Clipboard to cut selected text and transfer it over to a textbox.
Can anyone help me with this? So to put it plainly I want to know how the best way to access text (selected or not) in embedded PDF Reader Component.