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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

VC++ : ProPrintExecute : need help/example

Madhavi
11-Garnet

VC++ : ProPrintExecute : need help/example

Hello All,

 I am trying to export the current sheet of a drawing to either .pdf/tiff.

I am using ProPrintExecute.

Can someone please share a sample of this function?

My code is as below but it say: PRO_TK_BAD_INPUTS

int Window_Id;
ProError Status = ProWindowCurrentGet(&Window_Id);
ProPrintPrinterOpts* PrintOptions = new ProPrintPrinterOpts;
ProPrintMdlOpts* PrintMdlOptions = new ProPrintMdlOpts;
ProPrintPlacementOpts* PrintPlacementOptions = new ProPrintPlacementOpts;
PrintOptions->save_to_file = PRO_B_TRUE;
ProStringToWstring(PrintOptions->filename, "c:\\test\\test.pdf");
Status = ProPrintMdlOptionsGet(curMdl, PrintMdlOptions);
PrintMdlOptions->sheets = PRINT_SELECTED_SHEETS;
PrintMdlOptions->mdl = curMdl;
PrintMdlOptions->range[0] = 1;
PrintMdlOptions->range[1] = 1;
PrintMdlOptions->use_drawing_size = PRO_B_TRUE;
//PrintPlacementOptions->place_label = PRO_B_TRUE;
PrintPlacementOptions->scale = 1;
Status = ProPrintExecute(Window_Id, PrintOptions, PrintMdlOptions, PrintPlacementOptions);

 // Here status becomes PRO_TK_BAD_INPUTS

1 ACCEPTED SOLUTION

Accepted Solutions
Madhavi
11-Garnet
(To:Madhavi)

Just FYI @PARTHIBAN_K Here is the Solution 🙂

 

int Window_Id;
ProError Status = ProWindowCurrentGet(&Window_Id);
ProPrintPrinterOpts* PrintOptions = new ProPrintPrinterOpts;
ProPrintMdlOpts* PrintMdlOptions = new ProPrintMdlOpts;
ProPrintPlacementOpts* PrintPlacementOptions = new ProPrintPlacementOpts;

Status = ProPrintPrinterOptionsGet("TIFF", PrintOptions);
Status = ProPrintMdlOptionsGet(curMdl, PrintMdlOptions);
Status = ProPrintPlacementOptionsGet(PrintPlacementOptions);

PrintMdlOptions->sheets = PRINT_SELECTED_SHEETS;
PrintMdlOptions->use_drawing_size = PRO_B_TRUE;
PrintOptions->save_to_file = PRO_B_TRUE;
PrintOptions->send_to_printer = PRO_B_FALSE;

ProStringToWstring(PrintOptions->filename, "c:\\test\\test.tif");
PrintPlacementOptions->scale = 1;

Status = ProPrintExecute(Window_Id, PrintOptions, PrintMdlOptions, PrintPlacementOptions);

View solution in original post

3 REPLIES 3
PARTHIBAN_K
15-Moonstone
(To:Madhavi)

Hi @Madhavi

 

I don't know it would work yet try this. I just assumed

 

Int Window_Id;
ProError Status = ProWindowCurrentGet(&Window_Id);


ProPrintPrinterOpts* PrintOptions = new ProPrintPrinterOpts;

ProPrintPrinterOpts* PrintOptions = NULL;


ProPrintMdlOpts* PrintMdlOptions = new ProPrintMdlOpts;

ProPrintMdlOpts* PrintMdlOptions = NULL;


ProPrintPlacementOpts* PrintPlacementOptions = new ProPrintPlacementOpts;

ProPrintPlacementOpts* PrintPlacementOptions = NULL;


PrintOptions->save_to_file = PRO_B_TRUE;
ProStringToWstring(PrintOptions->filename, "c:\\test\\test.pdf");


Status = ProPrintMdlOptionsGet(curMdl, PrintMdlOptions);

Status = ProPrintMdlOptionsGet(curMdl, &PrintMdlOptions);


PrintMdlOptions->sheets = PRINT_SELECTED_SHEETS;
PrintMdlOptions->mdl = curMdl;
PrintMdlOptions->range[0] = 1;
PrintMdlOptions->range[1] = 1;


PrintMdlOptions->use_drawing_size = PRO_B_TRUE;


//PrintPlacementOptions->place_label = PRO_B_TRUE;
PrintPlacementOptions->scale = 1;


Status = ProPrintExecute(Window_Id, PrintOptions, PrintMdlOptions, PrintPlacementOptions);

Status = ProPrintExecute(Window_Id, &PrintOptions, &PrintMdlOptions, &PrintPlacementOptions);

Parthiban Kannan

href="https://www.linkedin.com/in/parthiban-kannan/" target="_blank"

Thanks for looking into my question @PARTHIBAN_K.

Well Null won't work as it should be initialized before I start assigning values to it.

And about '&' .. it's already a pointer variable so '&' not needed.

 

But Thanks for giving it a try.

I think I am missing few assignments..but do not know which are those 😐

 

 

Madhavi
11-Garnet
(To:Madhavi)

Just FYI @PARTHIBAN_K Here is the Solution 🙂

 

int Window_Id;
ProError Status = ProWindowCurrentGet(&Window_Id);
ProPrintPrinterOpts* PrintOptions = new ProPrintPrinterOpts;
ProPrintMdlOpts* PrintMdlOptions = new ProPrintMdlOpts;
ProPrintPlacementOpts* PrintPlacementOptions = new ProPrintPlacementOpts;

Status = ProPrintPrinterOptionsGet("TIFF", PrintOptions);
Status = ProPrintMdlOptionsGet(curMdl, PrintMdlOptions);
Status = ProPrintPlacementOptionsGet(PrintPlacementOptions);

PrintMdlOptions->sheets = PRINT_SELECTED_SHEETS;
PrintMdlOptions->use_drawing_size = PRO_B_TRUE;
PrintOptions->save_to_file = PRO_B_TRUE;
PrintOptions->send_to_printer = PRO_B_FALSE;

ProStringToWstring(PrintOptions->filename, "c:\\test\\test.tif");
PrintPlacementOptions->scale = 1;

Status = ProPrintExecute(Window_Id, PrintOptions, PrintMdlOptions, PrintPlacementOptions);

Top Tags