How can I convert MicroStation (DGN) files to PDF via command line?
The OpenDesign Alliance has libraries for dgn and dwg with pdf capabilities.
You could could use them to create the command line utility.
Decision Graphics http://www.dgnlink.com/ has a number of products that convert DGN to DWG, all of which can be run from a command line.
Once you have the DWG files, you can use one of the command line DWG to PDF converters (I can't recommend a specific one but a quick Google will find loads), or if you have a copy of AutoCAD or AutoCAD LT, you could write a script for that to convert the DWGs by using the DWG To PDF plotter.
From command line parameters, you can not do it. But you can create a Visual Basic or VB.NET application that will lunch microstation to do it for you.
I have been struggling with this one for a long time. All of the existing tools out there require expensive per-user licenses, which was a no-go for my implementation.
I solved the issue with a combination of three things:
Downloaded Bentley Viewer. This is their 100% free viewing/printing application.
Set up a virtual Windows postscript printer using GhostScript and RedMon. There are various guides online for this, and it can be a bit tricky to track down all of the prerequisites, but it is quite stable once set up correctly. Here is one guide: GhostScript/RedMon Guide
Use a "Key-In" script to pass print commands to Bentley View. This involves simply creating a text file with the required commands (List of Commands) and passing it AND the file you want to convert on the command line as such:
BentleyView.exe -M [Filename.dgn] -S[KeyIn FileName]
Please note that you need a space between the -M and the DGN filename but NOT between the -S and the Key-In script filename.
The script I used to simply print the document and then quit the GUI was:
PRINT PRINTERNAME PDFWriter
PRINT EXECUTE
QUIT
This is not a perfect solution at all, especially since it requires the installation of Bentley View and it also opens a UI when called (although it does close it immediately after printing).
Related
I'm using jasperstarter (a java program, open source) to generate reports that I define in iReports. This runs in windows and I need the output PDF generated to be directly read by the calling process which is a C# program.
Jasperstarter has lots of options like viewing the PDF generated directly, or generating the PDF as a file, sending it to printer, but no option to stream the result PDF to the calling process.
Is this possible at all, even if I have to change jasperstarter's open source code? How?
Is this possible in some other way that doesn't imply changing the jasperstarter's code? How?
Actually the answer was quite easy. I've downloaded jasperstarter and was able to use JasperExportManager.exportReportToPdfStream method which already existed on jasper's library to export the pdf to "System.out" stream. Together with adding a new option to run this process, this makes jasperstarter to be able to allow for redirection of the PDF's result (pipe '|' and redirect can be used directly on the program).
I tried contact with jasperstarter's project owner to see if I can get this change commited on the master branch.
I have been trying for a very long time to convert files to G3D, the only success I had is drag-and-drop files on the fbx-conv.
I understood there is a exporter for blender, even a way to convert fbx in code...
I can't make any of them to work, can someone help me with a very precise tutorial or step by step instructions?
At the building section I did as it said, I tried all that I could think of but to no use.
There is an addon for Blender that exports directly to .g3dj format.
Check this link for info on setting it up:
http://www.gamefromscratch.com/post/2014/02/26/Exporting-3D-model-to-LibGDX-directly-from-Blender.aspx
The G3D file format is deprecated and replaced by the G3DJ and G3DB file format. FBX-Conv can be used to convert FBX (and other file formats) to either a g3dj or g3db file. As far as I know there is no exporter directly to g3dj/b for blender yet, instead export to FBX and then convert using fbx-conv. Fbx-conv is a command line utility. If you are unfamiliar with command line utilities, you might want to search the internet for some information on running those on your operating system. Run fbx-conv without arguments to see all possible options.
A tutorial you might be interested in: http://blog.xoppa.com/loading-models-using-libgdx/
I am a beginner in the field of Data Mining. I have a data which i need to process before visualizing any useful results. So I do the following:
Preprocess data using Java Program ( Output : txt files) (Input: FileNames)
Convert .txt files to .xls files ( Excel file)
Import excel file in MATLAB
Write Matlab Script to draw some plots on the imported data
I wish to automate this process by just pressing run button and then it happens automatically.
Please guide me how to integrate my work so instead of doing these 4 steps each time i just provide input file names and all the work is done in one go.
Thanks!
You can use arbitrary Java classes from within MATLAB - it is supported to run user-defined classes and even pass data between them and MATLAB. This would give you the following benefits:
no need to write text files/XLS and then import them into matlab
write everything in one MATLAB script - that is what duffymo had in mind, just that you do not need any shell/batch processing. Everything is done in MATLAB
you could add a MATLAB-implemented GUI to handle the process
Have a look at this SO post for some insights.
You want a scripting language: Windows command if you're on that platform; shell scripts on Linux.
It might not be a button, because that implies a UI. You have to write what amounts to an application for that.
The java matlabcontrol library might come in handy
http://code.google.com/p/matlabcontrol/
I had a similar task some time ago. Matlabcontrol is a library which connects MATLAB to your Java program and is quite easy to use.
All steps can be done in Matlab environment.
Java code can be called in Matlab directly. Just add your java class path to Classpath.txt in Matlab and import in the script code.
Maybe CSV data file is better for your case.
In my Java application, I have PDF files that I eventually need to convert to PCL and send to a RightFax server. I'll also need to embed codes in the PCL files that RightFax will read to know where to send the fax.
What's the best approach towards doing this?
Searching online, it seems like I could use Java's StreamPrintService to print the PDF files to PCL. Is this correct? Does this also mean that I must have installed on my OS a printer that can interpret PCL?
Once the PCL file is generated, I need to add the embedded codes in the file. Do I add the codes to the end of the file (by opening it in Java and writing out to it)?
The simplies solution, IMHO, is to drop the PDF into a folder on the RightFax server. Then create a small text file with all the instructions for who to send the document to etc. using Embedded Codes or FCL (Fax Command Language). We do this all of the time and it works great. Note: Fax Command Languate is only available if you have the Integration Module. Both Embedded Codes and FCL each have a command to attach a file(s). Once RightFax receives this text file it will process the commands and attach the PDF and fax and/or email the document. Here are two examples (one Embedded and one FCL).
Embedded Code File:
<TOFAXNUM:999999999>
<TONAME:Douglas Anderson>
<BILLINFO1:12345>
<NOCOVER>
<WHO:DOUG>
<ADDDOC2: C:\pdfFiles\12345.pcl>
FCL Code File:
{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{attach C:\pdfFiles\12345.pcl delete}}
{{imagetype pdf}}
{{end}}
Sending this simple text file to RightFax will prompt it to process and insert the document you specify. There are vaious ADDDOC commands and switchinges for ATTACH that tell RightFax to delete the file once it has been sent etc.
The Embedded Code File can be sent in via the HPFAX queue and the FCL can be sent in via the Production Inbox (c:\program files\rightfax\production\inbox).
This gives a lot of control and allows for easier troubleshooting as you still have a PDF that is viewable (due to the fact that you didn't stick text at the start of it), and you can easily output the Embedded Code or FCL files to an alternate folder for viewing and even modifying with simple tools like Notepad.
Edit: OpenSource is correct that you can concatenate files together, I haven't done this with Embedded Codes for a long time (see example at end) but have done something similar with FCL (if you have the Ingetration Module you can do this).
FCL with PDF or Postscript embedded in data (RightFax treats PS and PDF):
{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{beginpostscript}}
%PDF-1.3...
...your pdf...
{{endpostscript}}
{{end}}
The PCL variant looks like this:
{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{beginpcl}}
...your pcl data...
{{endpcl}}
{{end}}
False first page with Embedded Codes (as per my notes from something we did a long time ago):
<TOFAXNUM:999999999>
<TONAME:Douglas Anderson>
<BILLINFO1:12345>
<NOCOVER>
<WHO:DOUG>
<DELETEFIRSTPAGE>
*PCL formfeed character*
...your pcl data...
Whatever you send will appear on the 'first page' but this will be deleted. The other option is to send this data after the Formfeed a the end of the document and use the <DELETELASTPAGE> option. This data can also appear inline with the PCL file itself and as such you may be able to send it at the start of the job without the <DELETEFIRSTPAGE> command and the formfeed splitter.
We have a very similar process. What we do is we have a pcl file and a control file (a text file with the rightfax instructions in it). We concatenate these two files using java NIO and send it across to the rightfax print queue. We basically create a new file and write the above two into the new file using the transferFrom() method in the channel which is got by stream.getChannel(). We put control instructions at the top not at the bottom as you have mentioned? may be you misstated it - I think Rightfax needs it at the top. I have to admit I have not tried to send it at the bottom. May be it will work just dont know.
JPS lets you print to file so you just need to print to file on a PCL printer.
print-to-file seems to be the right approach here.
We are doing an app to manage and print Word, Excel, PowerPoint, and PDF files...
No application can be shown to the user when printing.
To do that, we find some command-line arguments that work well:
(using openoffice.org)
"C:\Program Files\OpenOffice.org 3\program\soffice.exe" -norestore -nofirsts tartwizard -nologo -headless -pt MicrosoftXPSDocumentWriter doc1.doc
(using ms word)
"C:\Program Files\Microsoft Office\Office\WINWORD.EXE" doc1.doc /q /n /mFilePrintDefault /mFileExit
But we just can't find any option to set the page range to print...
Is this possible? Another option to print those documents without showing anything to the user?
Thanks for reading.
any ideas would be appreciated
I would really rethink doing this app in Java. If the application is to manage word documents, and your interaction with word consists of assumptions that word is installed on the local machine, then java isn't adding anything to the party. .NET is likely the right way to go here (where you could easily interact with the office com objects to get what you need).
That being said, for open office, look at the open office SDK which you would have to make as part of your installer for this app.
For Microsoft Office, I would look at a Java-COM bridge (such as Jacob) to call the COM objects. If that is not an option, you could as part of your install process install a Macro into Word that you could call with the /m parameter and pass in the range values you need - but that would get very ugly very fast.