Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hello,
I'm working on small idea to export the assembly drawing into one Set of pdfs.
So to export, using JLink, there is the option:
PDFOPT_LAUNCH_VIEWER, boolean False
But the JLink / Export Instructions is ignoring this feature without any Message? Are there any ideas?
System: Creo 4 / M040 / Win 10 / HP Zbook
Edit: Forget to mention the problem.
All other options are working.
After adding the Option PDFOPT_LAUNCH_VIEWER, False the other options are also ignored.
The Code in detail:
public void exportDrawingAsPdf (Drawing drawing) {
String path = "C:\\JavaProjects\\Java201";
log.info("Speicherpfad PDF: " + path);
try {
String filename =
drawing.GetFullName().toString() + ".pdf";
PDFExportInstructions instructions = PDFExportInstructions_Create();
instructions.SetFilePath(path);
// All options are stored in this container
PDFOptions optionsContainer = PDFOptions.create();
log.info("PDF optionsContainer created");
// Create now the single options
PDFOption pdfOption = PDFOption_Create();
// PDF Options - Do not Open
pdfOption.SetOptionType(PDFOptionType.PDFOPT_LAUNCH_VIEWER);
pdfOption.SetOptionValue(pfcArgument.CreateBoolArgValue(false));
optionsContainer.append(pdfOption);
log.info("PDF Launch Viewer OFF");
// Searchable Text
pdfOption.SetOptionType(PDFOptionType.PDFOPT_SEARCHABLE_TEXT);
pdfOption.SetOptionValue(wrapAsArgValue(true));
optionsContainer.append(pdfOption);
log.info("PDF Searchable Text" );
// PDF Options - Stroke Fonts
// Option: 0 Stroke Fonts, 1 TrueType
pdfOption.SetOptionType(PDFOptionType.PDFOPT_FONT_STROKE);
pdfOption.SetOptionValue(wrapAsArgValue(0));
optionsContainer.append(pdfOption);
log.info("PDF Stroke Fonts");
// PDF Options - Use Pentable
pdfOption.SetOptionType(PDFOptionType.PDFOPT_PENTABLE);
pdfOption.SetOptionValue(wrapAsArgValue(true));
optionsContainer.append(pdfOption);
log.info("PDF use Pentable TRUE" );
// PDF Options - Only Grayscale (1)
pdfOption.SetOptionType(PDFOptionType.PDFOPT_COLOR_DEPTH);
pdfOption.SetOptionValue(wrapAsArgValue(1));
optionsContainer.append(pdfOption);
log.info("PDF ColorDepth GRAY");
instructions.SetOptions(optionsContainer);
log.info("PDF Drawing Options Set");
//Pfad erstellen
String exportPath = Paths.get(path, filename).toString();
drawing.Export(exportPath, instructions);
log.info("Zeichnung erstellt: " + exportPath);
} catch (Throwable t) {
JLinkThrowable.logJLinkException(log, t);
}
}
Solved! Go to Solution.
I changed the code, now it is working fine.
I create a new PDFOption for every Options and add this to my optionsContainer.
See code attached:
String filename =
drawing.GetFullName().toString() + ".pdf";
PDFExportInstructions instructions = PDFExportInstructions_Create();
instructions.SetFilePath(path);
// All options are stored in this container
PDFOptions optionsContainer = PDFOptions.create();
log.info("PDF optionsContainer created");
// PDF Options - Do not Open
PDFOption pdfOptionShow = PDFOption_Create();
pdfOptionShow.SetOptionValue(wrapAsArgValue(false));
pdfOptionShow.SetOptionType(PDFOptionType.PDFOPT_LAUNCH_VIEWER);
optionsContainer.append(pdfOptionShow);
log.info("PDF Launch Viewer OFF");
// PDF Options - Stroke Fonts
// Option: 0 Stroke Fonts, 1 TrueType
PDFOption pdfOptionStroke = PDFOption_Create();
pdfOptionStroke.SetOptionValue(wrapAsArgValue(0));
pdfOptionStroke.SetOptionType(PDFOptionType.PDFOPT_FONT_STROKE);
optionsContainer.append(pdfOptionStroke);
log.info("PDF Stroke Fonts");
// Searchable Text
PDFOption pdfOptionSearch = PDFOption_Create();
pdfOptionSearch.SetOptionType(PDFOptionType.PDFOPT_SEARCHABLE_TEXT);
pdfOptionSearch.SetOptionValue(wrapAsArgValue(true));
optionsContainer.append(pdfOptionSearch);
log.info("PDF Searchable Text" );
// PDF Options - Use Pentable
PDFOption pdfOptionPentable = PDFOption_Create();
pdfOptionPentable.SetOptionType(PDFOptionType.PDFOPT_PENTABLE);
pdfOptionPentable.SetOptionValue(wrapAsArgValue(true));
optionsContainer.append(pdfOptionPentable);
log.info("PDF use Pentable TRUE" );
// PDF Options - Only Grayscale (1)
PDFOption pdfOptionColor = PDFOption_Create();
pdfOptionColor.SetOptionType(PDFOptionType.PDFOPT_COLOR_DEPTH);
pdfOptionColor.SetOptionValue(wrapAsArgValue(1));
optionsContainer.append(pdfOptionColor);
log.info("PDF ColorDepth GRAY");
instructions.SetOptions(optionsContainer);
log.info("PDF Drawing Options Set");
I changed the code, now it is working fine.
I create a new PDFOption for every Options and add this to my optionsContainer.
See code attached:
String filename =
drawing.GetFullName().toString() + ".pdf";
PDFExportInstructions instructions = PDFExportInstructions_Create();
instructions.SetFilePath(path);
// All options are stored in this container
PDFOptions optionsContainer = PDFOptions.create();
log.info("PDF optionsContainer created");
// PDF Options - Do not Open
PDFOption pdfOptionShow = PDFOption_Create();
pdfOptionShow.SetOptionValue(wrapAsArgValue(false));
pdfOptionShow.SetOptionType(PDFOptionType.PDFOPT_LAUNCH_VIEWER);
optionsContainer.append(pdfOptionShow);
log.info("PDF Launch Viewer OFF");
// PDF Options - Stroke Fonts
// Option: 0 Stroke Fonts, 1 TrueType
PDFOption pdfOptionStroke = PDFOption_Create();
pdfOptionStroke.SetOptionValue(wrapAsArgValue(0));
pdfOptionStroke.SetOptionType(PDFOptionType.PDFOPT_FONT_STROKE);
optionsContainer.append(pdfOptionStroke);
log.info("PDF Stroke Fonts");
// Searchable Text
PDFOption pdfOptionSearch = PDFOption_Create();
pdfOptionSearch.SetOptionType(PDFOptionType.PDFOPT_SEARCHABLE_TEXT);
pdfOptionSearch.SetOptionValue(wrapAsArgValue(true));
optionsContainer.append(pdfOptionSearch);
log.info("PDF Searchable Text" );
// PDF Options - Use Pentable
PDFOption pdfOptionPentable = PDFOption_Create();
pdfOptionPentable.SetOptionType(PDFOptionType.PDFOPT_PENTABLE);
pdfOptionPentable.SetOptionValue(wrapAsArgValue(true));
optionsContainer.append(pdfOptionPentable);
log.info("PDF use Pentable TRUE" );
// PDF Options - Only Grayscale (1)
PDFOption pdfOptionColor = PDFOption_Create();
pdfOptionColor.SetOptionType(PDFOptionType.PDFOPT_COLOR_DEPTH);
pdfOptionColor.SetOptionValue(wrapAsArgValue(1));
optionsContainer.append(pdfOptionColor);
log.info("PDF ColorDepth GRAY");
instructions.SetOptions(optionsContainer);
log.info("PDF Drawing Options Set");