Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello,
Thank you for replying to my earlier queries, please help me with this.
I have written a Java Async App which loads a model(drawing) in session and then generates its PDF via
Drawing.Export(filename, pdfexportinstructions);
I occasionally get an exception "pfcExceptions$XToolkitCommError" while exporting or sometimes while retrieving/displaying model. And the exception is random, which is making it hard to debug.
I am using session.RetrieveModel(Model Descriptor) to get model from current working directory.
If you need any information else, please ask. Quick help would be appreciated. Thanks
Solved! Go to Solution.
Try to set file path to both PDFExportInstructions and Drawing.Export .. Make sure the ".pdf" extension is in the path and path is absolute path (eg c:/users/user_name/desktop/test.pdf). This is working for me.
When retrieving non-existing model (or model which can not be found) its normal when exeption is thrown.
When retrieving model which is not in working dir or search path or session you have to use RetrieveModelWithOpts() instead.
When exporting pdf you must have properly configured PdfOptions and ExportInstructions. Eg your path is wrong or contain not allowed characters (such as < which is part of filename on family table instance).
Thanks for quick response.
My drawings are in working directory and there are no special characters in filename. Even with same file, I sometimes get the mentioned exception.
For PDF Options I assume I am using the correct code, since it has generated PDFs many times. Here it is
PDFExportInstructions Mypdfexportinstructions = pfcExport.PDFExportInstructions_Create();
PDFOptions Myoptions = PDFOptions.create();
PDFOption MyPdfOption_Color = pfcExport.PDFOption_Create();
MyPdfOption_Color.SetOptionType(PDFOptionType.PDFOPT_COLOR_DEPTH);
MyPdfOption_Color.SetOptionValue(pfcArgument.CreateIntArgValue(PDFColorDepth._PDF_CD_COLOR));
Myoptions.append(MyPdfOption_Color);
PDFOption MyPdfOption_Layer = pfcExport.PDFOption_Create();
MyPdfOption_Layer.SetOptionType(PDFOptionType.PDFOPT_LAYER_MODE);
MyPdfOption_Layer.SetOptionValue(pfcArgument.CreateIntArgValue(PDFLayerMode._PDF_LAYERS_NONE));
Myoptions.append(MyPdfOption_Layer);
PDFOption MyPdfOption_Launcher = pfcExport.PDFOption_Create();
MyPdfOption_Launcher.SetOptionType(PDFOptionType.PDFOPT_LAUNCH_VIEWER);
MyPdfOption_Launcher.SetOptionValue(pfcArgument.CreateBoolArgValue(false));
Myoptions.append(MyPdfOption_Launcher);
Mypdfexportinstructions.SetOptions(Myoptions);
proeDrawing.Export(filename, Mypdfexportinstructions);
any idea?
Try to set file path to both PDFExportInstructions and Drawing.Export .. Make sure the ".pdf" extension is in the path and path is absolute path (eg c:/users/user_name/desktop/test.pdf). This is working for me.
Thank you, this did the trick! No error now 🙂