Last active
July 31, 2020 11:29
-
-
Save slazav/2c617b8e7ba09ec67e1e633b043f89dd to your computer and use it in GitHub Desktop.
command-line converter DXF to PDF using QCAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converting DXF file to PDF without GUI | |
// Usage: | |
// qcad -autostart dxf2pdf.js <in_file> <out_file> | |
// | |
// V.Zavjalov, 03.07.2020, GLP-3.0 | |
include("scripts/simple.js"); | |
include("scripts/File/Print/Print.js"); | |
function main() { | |
if (args.length != 3) { | |
print("Usage: qcad -autostart " + args[0] + " <in_file> <out_file>"); | |
return; | |
} | |
var i_file = getAbsolutePathForArg(args[1]); | |
var o_file = getAbsolutePathForArg(args[2]); | |
// create a document: | |
var doc = createOffScreenDocument(); | |
// read DXF | |
var di = new RDocumentInterface(doc); | |
di.importFile(i_file); | |
// make view | |
var scene = new RGraphicsSceneQt(di); | |
var view = new RGraphicsViewImage(); | |
view.setScene(scene); | |
// write PDF | |
var pr = new Print(undefined, doc, view); | |
pr.print(o_file); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Converter script:
See also Altlinux package: http://git.altlinux.org/people/slazav/packages/?p=qcad-dxf2pdf.git