I have created code which export all shet in single pdf.
How can i use ExcludeFromPrinting and ExcludeFromCount in my following code?Please suggest any option for that?
public void SavePDF_AllSheet(Inventor.Application m_inventorApplication)
{
Inventor.TranslatorAddIn PDFAddin = m_inventorApplication.ApplicationAddIns.ItemById["{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}"] as Inventor.TranslatorAddIn;
DrawingDocument oDocument = (DrawingDocument)m_inventorApplication.ActiveDocument;
Inventor.TranslationContext oContext = m_inventorApplication.TransientObjects.CreateTranslationContext();
oContext.Type = Inventor.IOMechanismEnum.kFileBrowseIOMechanism;
Inventor.NameValueMap oOptions = m_inventorApplication.TransientObjects.CreateNameValueMap();
// Create a DataMedium object
Inventor.DataMedium oDataMedium = m_inventorApplication.TransientObjects.CreateDataMedium();
PropertySet customPropset;
customPropset = oDocument.PropertySets["Inventor User Defined Properties"];
Inventor.Property propProjectNumber = null;
Inventor.Property propCostID = null;
string inputjobnum = string.Empty, inputcostcode = string.Empty;
Regex RgxUrl = new Regex("^[a-zA-Z0-9]*$");
try
{
propProjectNumber = customPropset["Project Number"];
inputjobnum = Convert.ToString(propProjectNumber.Value);
}
catch (Exception)
{
}
try
{
propCostID = customPropset["Cost Code"];
inputcostcode = Convert.ToString(propCostID.Value);
}
catch (Exception)
{
}
if (propProjectNumber == null || propCostID == null)
{
MessageBox.Show("Job number and/or Cost code is not present in custom properties.", "No Data");
return;
}
int sheetCount = oDocument.Sheets.Count;
// Check whether the translator has 'SaveCopyAs' options
if (PDFAddin.HasSaveCopyAsOptions[oDocument, oContext, oOptions])
{
// Options for drawings...
oOptions.Value["All_Color_AS_Black"] = 1;
oOptions.Value["Remove_Line_Weights"] = 1;
oOptions.Value["Vector_Resolution"] = 400;
// oOptions.Value["Sheet_Range"] = Inventor.PrintRangeEnum.kPrintSheetRange;
oOptions.Value["Sheet_Range"] = PrintRangeEnum.kPrintAllSheets;
oOptions.Value["Custom_Begin_Sheet"] = 1;
oOptions.Value["Custom_End_Sheet"] = sheetCount;
}
string filename = oDocument.DisplayName;
string FilePathOriginalPDF = "G:\\PROJECTS\\" + Convert.ToString(inputjobnum) + "\\(03) Design\\(06) PDF\\";
string FilePathDublicatePDF = "G:\\PROJECTS\\" + Convert.ToString(inputjobnum) + "\\(00) ShopDocs\\" + Convert.ToString(inputcostcode);
Directory.CreateDirectory(FilePathOriginalPDF);
Directory.CreateDirectory(FilePathDublicatePDF);
// Set the destination file name
oDataMedium.FileName = FilePathOriginalPDF + Convert.ToString(inputcostcode) + "-" + filename + ".pdf";
// Publish document.
PDFAddin.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium);
System.IO.File.Copy(oDataMedium.FileName, FilePathDublicatePDF + "\\" + Convert.ToString(inputcostcode) + ".pdf", true);
MessageBox.Show("PDF saved successfully.", "PDF");
}