Create a thumbnail of a dwg in in a linux environment - ruby-on-rails

Creating a ruby on rails site that uses RMagick to create thumbnails for many types of images. RMagick cannot read dwg files however.
I've tried a few things, looked into the Java library JDWGLib, which would probably allow me to write a converter, but it would be a total from the ground up solution, where I just need a thumbnail.
Also considered using a viewer program to open the file in a remote X session and do a screen capture, however I'm not sure how I could ever guarantee that the viewer had completed opening when I took the screenshot.
I'm not concerned with being able to manipulate the file other than to create the thumbnail. It is going to be used for commercial purposes, so any libraries used need to be compatible.

cad2svg is a simple Linux command-line utility that automatically converts AutoCAD files (both dwg and dxf) to SVG.
the link

I could not find any command-line-able tool for making thumbnails, on either windows or linux.
I guess you could download the DWGdirect lib (C++) wich allows the exportation of a DWG to a bitmap... but this requires purchasing a membership license on the """Open""" Design Aliance.
I would recommend adding an additional file input on your form that says "thumbnail". And let the users provide the screenshots.

Related

SCORM package (e-learning course) localisation

I have to prepare e-learning course for translation in a CAT tool, but I don't have experience with this type of content.
The client sent me a SCORM package, containing mainly js, xml and HTML files.
I can work with them, but I am not sure if the course will work properly after translation and I don't know how to test it?
Can I use the SCORM package or I have to ask for text extraction from the authoring tool in which the course was created?
Thank you!
One of the easiest ways to test a SCORM package is to create a free account on SCORM Cloud, https://cloud.scorm.com. Once you have an account you'll be able to upload the zip file, launch the content and see how it plays and what it records, etc. The tool also allows re-uploading to see the different version, etc. If you have trouble or questions email support#scorm.com for assistance. I didn't understand the second question, it probably depends on which authoring tool and how extensive the edits are.
(Full disclosure I work for Rustici Software who owns SCORM Cloud.)

How to use an .xnb file in MonoGame on Windows 8?

I've got an .xnb file from a Windows Phone project made on Windows 7. I'd like to use the same asset in a Windows 8 Metro app. I've got MSVS 2012 RC on Windows 8 with a project from the MonoGameWindowsMetroApplication template. I put the .xnb file in the project Assets folder and tried to load it, but I get an exception telling me that the asset can't be loaded. What properties or configuration do I need to be able to use the .xnb file?
While MonoGame is working on the Content Pipeline piece of the framework, you can simply use the same Content Pipeline engine that you used for the Windows Phone 7 game to create a Content Pipeline and use the associated .xnb files in your Windows 8 XNA MonoGame project.
I have a blog tutorial series on building XNA games with MonoGame for Windows 8, and if you look at Part 3, I provide a step-by-stepy walkthrough of accomplishing this. My hands-on lab and information on my blog was reviewed and approved by the MonoGame team.
See info here: http://blogs.msdn.com/b/tarawalker/archive/2013/01/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame.aspx
The runtime Xna framework has many type reader objects that read the various xnb files. Some of the type readers are for xnb files that were processed from fbx models, others are xnb files processed from 2d image files, etc.
When you call content.Load<T>(xnb file name), The content manager uses the appropriate reader to read the byte information of the xnb file into the appropriate Xna class. The byte information in an xnb file is designed to be used in a specific Xna class, no other. There are no Xna classes in metro.
All this to say there are no type readers in the metro environment that read these xnb files. You would have to write your own. It's not that hard though, that's similar to what I did. I now process an fbx file into xnb by building an Xna project, then my xna project writes the runtime model's data to my own binary file, which I read from my metro app. But I could've simply read the xnb also. I just would have had to study the contentManager's & Model class' type readers to see how the byte info was distributed.
After all is said and done, it just means I don't have to learn the FBXSDK which would be the standard way (and arguably preferred way) of bringing in model info.
EDIT - sorry, didn't clue into the use of the mono framework. I don't know anything about that... Maybe they do have a way of importing xnb files.
Are you on the develop3D branch? I think you need to add a dummy Content project and add it to that project, not your assets, build that project first, then you need to reference that project in your MonoGame project.
I didn't succeed on that yesterday as I'm using the current stable but one of the MonoGame guys told me to do just that yesterday. Here are some instructions:
https://github.com/mono/MonoGame/wiki/MonoGame-Content-Processing
In MonoGame content pipeline is not present, at least as off now.
Its very easy.
1)Create a xna project in VS2010
2)add all your assets over there.
3)Rebuild your project. Go to bin/x86/debug/content and copy all contents from there
Now go to your VS2012 Mono Project bin/x86/debug look for content folder, if its there copy all content there else create a content folder and copy all content there.
Now without changing even single line of code just run your project and you will find everything working great!!!
Let me know if you find any difficulty doing that.

Any good PDF export filter that works with Fast Report?

I recently discovered that the PDFs exported by the Fast Report's PDF export filter aren't displayed correctly in Mac OSX, iOS and Android devices.
Fast Report informed that their pdf implementation only support Windows and they can't say when the new implementation that they are working on will be available.
I also tried to use the Gnostice export filter, but their demo installer didn't work in Delphi XE and when I contacted them, they took 15 days to send me some attached dcus which also didn't work. So I'm searching for another option.
If you know or use a PDF export filter which works with Fast Report, please let me know.
November 2015: Fast Report now have PDF/A support, with this option enabled the PDFs are fine on all platforms.
October 2014 - Fast Report 5 still seems to generate "Windows-only" PDF. A production-ready solution for this problem would be a benefit for cross-platform developers, given that Fast Report is the report generator bundled with Delphi.
Here is a fresh example generated with the Fast Report 5 demo, displayed with Adobe Reader 11 on Android 4.4:
And on Windows:
Fast Report informed that their pdf implementation only support Windows and they can't say when the new implementation that they are working on will be available.
I'm not sure that should be taken literally, considering PDF is supposed to be a cross platform format. It more likely means they don't actually have the time, equipment or expertise to test with those platforms. The PDF export filter that I'm using is the one built into Fast Report! It surely has some bugs, but I managed to work around them. And I think that might also work for you: Start with a simple document that does export properly, start adding features until it brakes, then you know what brakes it and you'll know how to work around the problem.
From my experience, here's what got me into trouble:
Rounded corners in the PDF document didn't look like the ones in the Fast Report preview. My fix: Found a combination of settings that made the exported PDF look exactly like the preview document. For me rounded corners were just a cosmetic feature, and with cosmetics there's no "One Look"; The alternative worked just fine. This might actually be fixed in the most recent version, but I didn't bother changing the document to test.
Transparency issues and outline issues. When working with the Fast Report editor (and when looking at it's previews) it's easy to overlap objects. You don't see this because of the object opacity. When exporting to PDF overlapped objects somehow managed to "print" outlines, and it obviously looked ugly. My fix: pay closer attention to those objects, make sure they don't overlap or make sure they don't generate outlines if no outlines are supposed to be seen.
Also make sure you test using ADOBE Reader, on any of the given platforms. If it works with the Adobe reader but doesn't work with other readers, there might be a bug in the 3rd party reader!
Edit: Here (link) is a sample PDF document generated by my Fast Reports application. I have no idea what kinds of documents you generate, but in my book that's a mighty complex document. Notice the diagonal line that starts where the table data ends, notice the embedded images (bar code, stamp, signature).
I opened that document on the following mobile devices:
iPad, running iOS: The document renders 90% ok. Images are not rendered at all, but they're not important to my document (and that's very likely a problem with the iOS reader). All the fancy colored lines and rounded corners are properly rendered. Some text is not properly rendered, and I'm pretty sure that didn't render because the "box" that contains it is too small for the contents. That most likely happens because I didn't embed the TTF fonts into the PDF and the Apple font on iOS didn't perfectly match the Microsoft font that was used on Windows.
Samsung Galaxy S2, running Android 2.3: The document renders 100% correctly.
Samsung Something(??), running Windows Mobile 6.5 and the FoxReader: The document is totally gibberish: pictures showed up but the spacing between letters was messed so bad it's impossible to read. I blame the reader, it's not Acrobat and it probably wanted to be "smart". And it broke it's teeth in my text encoding, because my text is not English.
About the PDF format: A document is "PDF" if it conforms to the standard, here's some Wikipedia info on that. In theory a PDF document should render exactly the same way any way you look at it, but there are forces at play that might work against this:
Not all readers are "Adobe Acrobat". In theory they're all compatible, in practice they're most like not 100% compatible.
PDFs that don't embed fonts depend on the fonts available on the host system. If they're not the exact same fonts there's trouble ahead, because they might have slightly differing sizes. Since we're talking about PDF's that were generated on Windows and opened on iOS or Android, those are obviously different platforms and they're guaranteed to use different fonts (because fonts are licensed, and I doubt Microsoft will licence it's fonts to Apple. I also doubt Apple would want Microsoft fonts). One possible solution is embedding fonts, but that makes your PDF files significantly larger.
AFAIK you can export your Fast Report pages as metafiles (i.e. vectorial Windows format, which is in fact a raw serialization of GDI commands).
Then you could be able to render those metafiles into PDF using our Open Source SynPDF library. It works from Delphi 5 up to XE, is Unicode ready, can embed true type fonts, and even create PDF/A files.
It is also able to export metafiles included in reports as vectorial pictures (and not bitmaps), and could therefore highly increase the pdf quality and at the same time shrink its size.
See for instance how it can be used for QuickReport. A similar technical should be used with Fast Report.
The Gnostice support answered my e-mail which I reported that their trial installer didn't work and send me some tips about which could be the problem and I was able to install it.
The company I work for already bought me a license and I already replaced the Fast Report Export Filter, which was a task as simple as droping 2 components on the same Form as the frxReport Object and setting 2 or 3 properties.
Also, to export the report programatically was also 2 lines of code and the information was easily found in their FAQ.
In the end, based on the recomendations and after looking for other options just to find abandoned components which doesn't have any updates for years, the Gnostice eDocEngine was the best solution.
Just hope they make their installer a little more "Programmer Friendly" as if it had complained about the lack of Fast Report's units in the search path I would've been able to at least have an idea of what was going on, instead of just getting an error and blaming them for having a trial installer which didn't work.
After replacing the filter and generating the PDF's using the eDocEngine component, the PDFs now work the same in iOS, OSX and Android.
Here is my workaround solution. It's not an universal one, but helped me in my case.
The main idea: use in report font with small file size (I've found Arial-like font with cyrillic charset with size 57kb). So the exported files can be 100-200 kb.
Details is here:
http://dev-doc.blogspot.com/2013/03/fastreport-4-font-reading-and-huge-file.html
I use wPDF from WPcubed components, it's really a great product, good value for money
You can always install one of the PDF printers. These are in fact PDF convertors that install as windows printer. They work from any application including FastReprt components - just print on them.

How to convert ODT to DOC/RTF without openoffice.org

Is there any way to convert odt documents to doc or rtf on linux without openoffice or any library that relies on having openoffice installed ?
OpenOffice.org and its derivatives (LibreOffice, Symphony, etc) currently have one of the best converters between ODF and the Microsoft formats (besides the ODF support built into MS Office).
If those converters are not an option for you, you can choose between some alternatives: Foremost you might want to check out the KOffice project which also offers command line tools for file conversion:
KOffice - File Filters
Then there is another open source project with a free BSD license available on SourceForge:
OpenXML/ODF Translator
This project offers not only add-ins for Microsoft Office, but also a stand-alone command line version which also runs on Linux.
Then there would also be a different approach: You can automate Google Docs using command line tools:
googlecl: Command line tools for the Google Data APIs
Google Docs file conversion have internally been based on the OpenOffice.org file filters, but as far as I know they have been replaced by Aspose, a library for document formats.
Aspose is available in several versions, and as you have a Linux dependency you might want to check out their Java version.
Aspose.Words for Java
The library has its price, but you won't find another library that is not a full office suite with that quality.
If you don't want to use OpenOffice, Google Docs is your best bet. Cross-platform, web-based, and free, it takes about 2 minutes. You would upload the file, and check convert, then redownload as a doc or pdf (depends on what you want).
http://docs.google.com/
You could try this freeware (Docx2Rtf) and run it under WINE.
Checkout unoconv. It relies on OpenOffice.org its core, but it doesn't rely on any GUI packages. I assume this is what you want?
Use http://zamzar.com/ It has great support for all those formats. And is not reliant on any other installed program.
And of course, being a web page, it will work on any OS.

Is it possible to create a custom distribution of OpenOffice, or a way to package it into my java application?

I've got simple java-based ppt->swf sub-project that basically works. The open source software out there, OpenOffice.org and JODConverter do the job great.
The thing is, to do this I need to install OO.o and run it in server mode. And to do that I have to install OO.o, which is allot of software (~160MB) just to convert the source PPT files to an intermediate format. Also, the public OO.o distributions are platform specific and I'd really like a single, cross platform set of files. And, I'd like to not interfer with a system's current settings, like file extension associations.
As things are now, my project is not particularly 'software distribution friendly'.
So, the questions are:
Is it possible to create a custom distribution of OpenOffice? How would one about this?
How lightweight and unobtrusive can I make the installation?
Would it be possible to have a truly cross platform distribution since there would be no OO.o UI?
Are there any licensing issues I need to be aware of? (On my list of things to check out, but if you them already then TIA!)
I have no idea to accomplish such task, but Microsoft has its PPT viewer that is for free and very small, maybe in .NET (C#) you can use some kinda function to save into a intermediate file that you need...
and by the way, how are you handling slide transictions?
I found a software that does that but you need MS PPT installed.
this was just an idea, now regarding your actually question:
you can create your own installation of OO, just jump to the Installation project and follow the lines.
I did not read 'til the end, but from the 1st paragraph it seams what you are searching for.
No, not unless you are neck deep coding in the OpenOffice project.

Resources