public void WorkerProcess() { SetPhase("Starting"); Document activeDoc = Globals.BookPublishingStartup.Application.ActiveDocument; SetFields(activeDoc.ContentControls.Count); SetShapes(activeDoc.Shapes.Count); SetPhase("Getting Inline Word fields"); WordFieldsInfo.Get(activeDoc, wordFields, ref keepGoing); SetPhase("Checking Shapes for fields"); WordFieldsInfo.GetFromShapes(activeDoc, wordFields, ref keepGoing, SetCurrentShape); string tempFileName = System.IO.Path.GetTempFileName(); if (keepGoing) { SetPhase("Writing PDF"); PDFForm.SaveDocToPDF(activeDoc, tempFileName); } if (keepGoing) { SetPhase("Adding Fields to PDF"); PDFForm.AddFieldsToPDF(tempFileName, txtFileName.Text, wordFields, ref keepGoing); } if (keepGoing) { SetPhase("Done"); } else { SetPhase("Stopped"); } SetGoEnabled(); }
public static bool CreatePDFForm(Document wordDoc, string targetFileName, ISynchronizeInvoke sync, ref bool keepGoing) { string tempName = Path.GetTempFileName(); WordFieldsInfo wfi = WordFieldsInfo.Get(wordDoc, sync); if (SaveDocToPDF(wordDoc, tempName)) { AddFieldsToPDF(tempName, targetFileName, wfi, ref keepGoing); } return(false); }