NSAttributedString with embedded images - nsattributedstring

Does anybody know of any code out there that would allow me to read RTF with images in NSAttributedString?
Yes I know that there is RTFD format and initWithRTF methods... But implementation of initWithRTF skips \pict tags so when I transfers RTF from Windows (MS Office) to osx and try to open it with NSTextView I don't see embedded images. Also I tryed it with librtf and I have some sussesfull results but in my opnion its ugly solution

Neither QuickLook nor TextEdit can deal with inline attachments, so I'm pretty sure Cocoa doesn't support them. librtf is your best bet.

Related

Display CHM file in JavaFX app

Is there a way to display Compiled Help manual CHM in a javaFX app, without using java.awt.Desktop from AWT ?
Calling A CHM reader using Runtime.getRuntime().exec(help.chm) is an option, but to make it cross platform, this would require every user in mac, win and linux to have a CHM reader installed.
What's the best option for a cross platform solution ? should I extract it to HTML and display it in javafx.scene.web.WebView ?
Given your wish to be platform independent, I'd advise to go to the HTML route as you yourself suggested. I don't know your reason for converting CHM to HTML if you also control the source, in that case I'd either use HTML directly or markdown to HTML.
You should try this. It's works for me!

Print a file from Watir

I'm looking at Watir-Webdriver to manipulate a browser. In particular, I'd like to open a local file and print it to a PDF file.
Yes, wkhtmltopdf would be a good thing, but it's not working for me on debian squeeze, for reasons that are difficult to ascertain. The page contains Javascript, which rules out many html-to-pdf options. wkhtmltopdf works on OS X, same version (0.9.9), so I know it's not a problem with how I'm using it (PDFKit and Ruby). I'd just like to sidestep these issues and try a different way. Opening up chromium on debian shows a perfectly rendered page.
How does one "print" from Watir?
Edit: After more reading, I think there is no way to do this.
You could take a png sreenshot, then use the prawn gem to convert the png screenshot to a pdf:
require 'prawn'
require 'watir-webdriver'
b = Watir::Browser.start 'watirwebdriver.com'
b.driver.save_screenshot 'screenshot.png'
Prawn::Document.generate 'screenshot.pdf' do
image 'screenshot.png', :scale => 0.5
end
b.close
You'll need to use something that lets you do automation at the OS level. such as Autoit or maybe RAutomation. not sure what exists to do this on *nix operating systems.
Watir only drives the browser in terms of what is inside the browser window, it has very limited capability to work the menus of the browser itself.

Arabic Locale Support in Flex

Today, I learn how to localize my Flex application and to support multiple languages. The tutorials on-line are great. However, non of them mention the Arabic locale.
So basically, I created the Arabic (Jordan) locale files in the SDK folder by using:
copylocale en_US ar_JO
I navigated to the locale folder and I was able to see the ar_JO folder in there... So I assume everything went smooth.
Next, I followed the tutorials (www.babelfx.org) and was able to localize my test application in English, French, and Arabic. Clicking on any of those languages switches the labels of my simple form/into the desired language... however:
When switching to the Arabic language the labels turn into empty square symbols. If you are wondering, yes I can open a notepad and type Arabic text and save it successfully.
When I type Arabic text into the text boxes, I can see the Arabic words that I typed correctly (the labels are still square symbols).
Any ideas what I might be missing here??
I tried changing the font of my application (right on the application tag I set the fontFamily) into Simplified Arabic which comes by default on Windows.
Thanks
Have you embedded a font into your swf which can render Arabic? Are you using that font? If the answer is no to either, then I suggest reading up on the subject.
One thing to remember about Flash and fonts is that it has incredible power which comes from the fact that one is able to embed actual fonts into the swf itself. One also needs to remember that Flash is incredibly finicky and is prone to throwing fits if you fail to do so.
The solution is to change the context-type to UTF-8. Three ways to accomplish this from within Flex Builder:
(Option 1) Right click the file from the File Navigator and select Properties
(Option 2) With the file open, navigate to the File menu and choose Properties
(Option 3) With the file open, press Alt + Enter to bring up the file Properties
Once the properties window is displayed, you will see the option to change the file encoding from Default to Other (UTF-8).
Note: At least for me, once I changed the content-type to UTF-8, I had to close my unsaved file, open it back up, and paste my contents back into the file in order to clear the error message. Then clean the project (Project -> Clean...) and let it rebuild.
I found the solution. Actually, I didn't have to embed any fonts or anything in order to get it working.
My problem was the encoding in the resources.properties file. I opened it in Notepad++, then I noticed the Encoding menu. At that time, I remembered reading something about that the encoding of the resources files should be UTF-8. So I converted the encoding to UTF-8 from the menu, compiled, it didn't work! After couple of retries and cleaning the project, it worked successfully!!!
Just a reminder for everybody (as I have fallen into this while working this problem out):
For mx components, embedded fonts must have the embedAsCFF set to false.

Alternative to HTML to PDF converter?

I've been using the Winnovative HTML to PDF converter for a few years, but I've noticed the quality can be impared because the images etc have first had to be rendered in HTML before being converted into a PDF format.
Winnovative have another option where you can add objects to the PDF Converter before outputting the result, but as this allows you to add HTML elements, I imagine this works in a similar way to the HTML to PDF converter (in terms of rendering).
Is there an alternative to this so that I can generate a PDF in my ASP.NET Web Application without it first having to be rendered as HTML?
I'm looking for the most high quality option
You can use iTextSharp library. It has an object representation of whole PDF document so it will allow you to add any elements you need without translating it from html elements. It also allows you to convert html to pdf, but of course you can do it manually instead by building PDF document from basic blocks...
If you will use version 4.x then it's free to use in commercial projects (LGPL license). Version 5.x is avaible on Affero General Public License so I believe you have to buy it to use in commercial projects, but the features I've described are avaible in the 4.xversion
try http://wkhtmltopdf.org/
it's lightning fast in comparison to iTextSharp.
For step by step installation check out these articles:
http://www.megustaulises.com/2012/12/mvcnet-convert-html-to-pdf-with-pechkin.html
http://w3facility.org/question/how-to-pass-html-as-a-string-using-wkhtmltopdf/
And this manual:
http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf-0.9.9-doc.html

Bitmap image are visible in Qt Designer but I can't see them after compiling in QDevelop IDE

In qt-designer I loaded bitmap images and in preview I am able to view the images. But after compiling in qdevelop IDE, I could not see the images at all.
Is there any procedure to load the bitmaps in to qdevelop.
Thanks in advance
I think you'll be wanting to add the bitmaps to a resource file, using Qt's resource system, if you want to be able to use them in Designer and also have them work in your compiled application correctly. I've not used it, but the examples look fairly straightforward, and it appears QDevelop supports the resource system to some extent.
Have you configured Qt to use required images plugins?
[-no-gif] [-qt-gif] [-no-libtiff] [-system-libtiff] [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng] [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]

Resources