Hi.
I'm trying to export to PNG with JavaScript in Corel Draw 2020 but the image is not exporting. I do not get an error either. Can anyone let me know what I'm doing wrong?
Thank you.
This is what I'm doing:
const opt = host.CreateStructExportOptions();opt.AntiAliasingType = host.cdrNormalAntiAliasing;opt.ImageType = host.cdrRGBColorImage;opt.Overwrite = true;const exportFileName = "C:\\test.png";host.ActiveDocument.Export(exportFileName, host.cdrPNG, host.cdrSelection, opt, undefined);
1) maybe you just didn't select shape for export
2) maybe also need to specify the resolution and image dimensions
Tried to do both, didn't work. Here's what I have now.
const opt = host.CreateStructExportOptions();opt.AntiAliasingType = host.cdrNormalAntiAliasing;opt.ImageType = host.cdrRGBColorImage;opt.Overwrite = true;opt.ResolutionX = 72;opt.ResolutionY = 72;opt.SizeX = opt.ResolutionX * 300;opt.SizeY = opt.ResolutionY * 300;const exportFileName = "C:\\test.jpg";let exporting = host.ActiveDocument.Export(exportFileName, host.cdrJPEG, host.cdrSelection, opt, undefined);
you finish export task? ExportFilter.Finish method - Developer Area - CorelDRAW Community
make sure the layer the shape is on is printable.
check the file name, maybe it would be more correct: "C:\test.jpg"?
Tried it. I get the error 'Can not read property 'Finish' of undefined'
Tried changing the file name. Did nothing. The shape is on a printable layer.
by the way, "Export" is not function, try use
host.ActiveDocument.Export("C:\Test.jpg", host.cdrJPEG, host.cdrSelection, opt)