Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
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
Solved! Go to Solution.
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);
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);
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 😐
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);