Changed generic ExportAsFixedFormat back to be generic and use the default value of UseISO19005_1.

Created a new version of ExportAsFixedFormat that takes a parameter DebugStatus to set UseISO19005_1.
Added logic to handle setting UseISO19005_1 when creating a PDF from an MSWord Section.
This commit is contained in:
Rich 2013-11-07 21:42:56 +00:00
parent fc371c5c82
commit b19ce7c128
2 changed files with 33 additions and 29 deletions

View File

@ -339,9 +339,7 @@ namespace LBWordLibrary
} }
public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat) public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat)
{ {
// iso 19005-1 compliant (PDF/A) should be set to false. setting it to true causes the background InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
// for x/y plots to be set to black rather than transparent. (2nd to last parameter (field is: UseISO19005_1) in next line)
InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, false, Missing.Value);
} }
public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat, Boolean OpenAfterExport, LBWdExportOptimizeFor OptimizeFor, LBWdExportRange Range, int From, int To, LBWdExportItem Item, Boolean IncludeDocProps, Boolean KeepIRM, LBWdExportCreateBookmarks CreateBookmarks, Boolean DocStructureTags, Boolean BitmapMissingFonts, Boolean UseISO19005_1, object FixedFormatExtClassPtr) public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat, Boolean OpenAfterExport, LBWdExportOptimizeFor OptimizeFor, LBWdExportRange Range, int From, int To, LBWdExportItem Item, Boolean IncludeDocProps, Boolean KeepIRM, LBWdExportCreateBookmarks CreateBookmarks, Boolean DocStructureTags, Boolean BitmapMissingFonts, Boolean UseISO19005_1, object FixedFormatExtClassPtr)
{ {

View File

@ -90,9 +90,9 @@ namespace LBWordLibrary
} }
throw new Exception("Cannot find a name to use"); throw new Exception("Cannot find a name to use");
} }
public string CreatePDF(string pdfFileName, bool openPDF) public string CreatePDF(string pdfFileName, bool openPDF,int DebugStatus)
{ {
pdfFileName = CreatePDF(pdfFileName); pdfFileName = CreatePDF(pdfFileName, DebugStatus);
if (openPDF) OpenPDF(pdfFileName); if (openPDF) OpenPDF(pdfFileName);
return pdfFileName; return pdfFileName;
} }
@ -120,13 +120,13 @@ namespace LBWordLibrary
Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.ffff} {1:yyyy-MM-dd HH:mm:ss.ffff} {2}", DateTime.Now, proc.ExitTime Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.ffff} {1:yyyy-MM-dd HH:mm:ss.ffff} {2}", DateTime.Now, proc.ExitTime
,TimeSpan.FromTicks(proc.ExitTime.Ticks - tStart.Ticks).TotalMilliseconds); ,TimeSpan.FromTicks(proc.ExitTime.Ticks - tStart.Ticks).TotalMilliseconds);
} }
public string CreatePDF(string pdfFileName) public string CreatePDF(string pdfFileName, int DebugStatus)
{ {
pdfFileName = AvailableFileName(pdfFileName); pdfFileName = AvailableFileName(pdfFileName);
if (((int)Convert.ToSingle(Version)) > 12) if (((int)Convert.ToSingle(Version)) > 12)
return CreatePDF2007(pdfFileName); return CreatePDF2007(pdfFileName, DebugStatus);
if (((int)Convert.ToSingle(Version)) == 12 && WordPDFExporterInstalled) if (((int)Convert.ToSingle(Version)) == 12 && WordPDFExporterInstalled)
return CreatePDF2007(pdfFileName); return CreatePDF2007(pdfFileName, DebugStatus);
else if (VolianPDFInstalled) else if (VolianPDFInstalled)
{ {
_MyLog.WarnFormat("Using VolianPDFWriter - MSWord Version = '{0}'", Version); _MyLog.WarnFormat("Using VolianPDFWriter - MSWord Version = '{0}'", Version);
@ -198,13 +198,13 @@ namespace LBWordLibrary
throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2003BG", ex); throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2003BG", ex);
} }
} }
public string CreatePDF2007(string pdfFileName, bool openPDF) public string CreatePDF2007(string pdfFileName, bool openPDF, int DebugStatus)
{ {
pdfFileName = CreatePDF2007(pdfFileName); pdfFileName = CreatePDF2007(pdfFileName, DebugStatus);
if (openPDF) OpenPDF(pdfFileName); if (openPDF) OpenPDF(pdfFileName);
return pdfFileName; return pdfFileName;
} }
public string CreatePDF2007(string pdfFileName) public string CreatePDF2007(string pdfFileName,int DebugStatus)
{ {
pdfFileName = AvailableFileName(pdfFileName); pdfFileName = AvailableFileName(pdfFileName);
// Removed to support MSWord 2010 and beyond. // Removed to support MSWord 2010 and beyond.
@ -212,7 +212,7 @@ namespace LBWordLibrary
// throw new Exception("MS Word PDF Exporter is not installed"); // throw new Exception("MS Word PDF Exporter is not installed");
try try
{ {
ActiveDocument.ExportAsFixedFormat(pdfFileName, LBWdExportFormat.wdExportFormatPDF); ActiveDocument.ExportAsFixedFormat(pdfFileName, LBWdExportFormat.wdExportFormatPDF, DebugStatus);
return pdfFileName; return pdfFileName;
} }
catch (Exception ex) catch (Exception ex)
@ -234,6 +234,12 @@ namespace LBWordLibrary
} }
public partial class LBDocumentClass : LBComObject public partial class LBDocumentClass : LBComObject
{ {
public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat, int DebugStatus)
{
// iso 19005-1 compliant (PDF/A) [UseISO19005_1] should be set to false. for compare print
// iso 19005-1 compliant (PDF/A) [UseISO19005_1] should be set to true for production print
InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, DebugStatus == 0, Missing.Value);
}
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public void SaveAs2000(string fileName) public void SaveAs2000(string fileName)
{ {