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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to Export Individual Sheets to Pdf in JLink

ddhini
15-Moonstone

How to Export Individual Sheets to Pdf in JLink

Here Is my code to Export drawing File .But I want to export sheets Individually .Please guide me to solve this .

 

My code :

PDFExportInstructions Mypdfexportinstructions = pfcExport.PDFExportInstructions_Create();
PDFOptions Myoptions = PDFOptions.create();
//FONT
/*set option to set Monochrome color plot*/
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);

Mypdfexportinstructions.SetOptions(Myoptions);//null is default
String modelLocation=""+Workingdr+"\\"; String drw_name = "Asm0001.drw"; ModelDescriptor desc1 = pfcModel.ModelDescriptor_Create(ModelType.MDL_DRAWING, drw_name, null); desc1 = pfcModel.ModelDescriptor_CreateFromFileName(drw_name); desc1.SetPath (modelLocation); draw=(Drawing)curSession.RetrieveModelWithOpts(desc1, pfcSession.RetrieveModelOptions_Create()); draw.Display(); draw.Export(""+draw.GetFullName()+""+ i1+"", Mypdfexportinstructions);

Its working fine .The code Exports all the sheets into one pdf. I want to to Export the sheets Individually

ACCEPTED SOLUTION

Accepted Solutions
ddhini
15-Moonstone
(To:ddhini)

 

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);//null is default
//Load Drawing Files....

				
String modelLocation=""+Workingdr+"\\";
String drw_name = ""+drawfiles[i]+".drw";
ModelDescriptor desc1 = pfcModel.ModelDescriptor_Create(ModelType.MDL_DRAWING, drw_name, null);
desc1 = pfcModel.ModelDescriptor_CreateFromFileName(drw_name);
desc1.SetPath (modelLocation);
draw=(Drawing)curSession.RetrieveModelWithOpts(desc1, pfcSession.RetrieveModelOptions_Create());
//Get total number of Sheets..
int nooffiles=draw.GetNumberOfSheets();
for(int no=1;no<=nooffiles;no++)
 {
  draw.SetCurrentSheetNumber(no);
  draw.Display();
 draw.Export(""+draw.GetFullName()+"-"+no+"", Mypdfexportinstructions);
continue;
}
//draw.Export(draw.GetFullName(), Mypdfexportinstructions);

I code the individual sheets to print as PDF  in Jlink .Thanks for everyones help .

View solution in original post

4 REPLIES 4
ddhini
15-Moonstone
(To:DavidBigelow)

@DavidBigelow 

David I wish to do this by Jlink .

Good. Please read my previous reply again... it is the framework of how to accomplish your goal.
ddhini
15-Moonstone
(To:ddhini)

 

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);//null is default
//Load Drawing Files....

				
String modelLocation=""+Workingdr+"\\";
String drw_name = ""+drawfiles[i]+".drw";
ModelDescriptor desc1 = pfcModel.ModelDescriptor_Create(ModelType.MDL_DRAWING, drw_name, null);
desc1 = pfcModel.ModelDescriptor_CreateFromFileName(drw_name);
desc1.SetPath (modelLocation);
draw=(Drawing)curSession.RetrieveModelWithOpts(desc1, pfcSession.RetrieveModelOptions_Create());
//Get total number of Sheets..
int nooffiles=draw.GetNumberOfSheets();
for(int no=1;no<=nooffiles;no++)
 {
  draw.SetCurrentSheetNumber(no);
  draw.Display();
 draw.Export(""+draw.GetFullName()+"-"+no+"", Mypdfexportinstructions);
continue;
}
//draw.Export(draw.GetFullName(), Mypdfexportinstructions);

I code the individual sheets to print as PDF  in Jlink .Thanks for everyones help .

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags