cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

JLink / PDF Export / PDFOPT_LAUNCH_VIEWER / Problem

ReiSi
4-Participant

JLink / PDF Export / PDFOPT_LAUNCH_VIEWER / Problem

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);
}


}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ReiSi
4-Participant
(To:ReiSi)

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");

 

View solution in original post

1 REPLY 1
ReiSi
4-Participant
(To:ReiSi)

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");

 

Top Tags