Package org.docx4j.events

Examples of org.docx4j.events.StartEvent


    }
    if (twoPass) {
      //1st pass in 2 pass
      log.debug("1st pass in 2 pass");
     
      StartEvent startEvent = new StartEvent( settings.getWmlPackage(), WellKnownProcessSteps.FOP_RENDER_PASS1 );
      startEvent.publish();
     
      placeholderLookup = new FopPlaceholderLookup(pageNumberInformation);
      formattingResults = calcResults(fopFactory, apacheFopMime, foDocumentSrc, placeholderLookup);
      placeholderLookup.setResults(formattingResults);
      foDocumentSrc = new StreamSource(new StringReader(foDocument));
     
      new EventFinished(startEvent).publish();
     
    }
   
    //1st pass in 1 pass or 2nd pass in 2 pass
   
    if (TEXTBOX_POSTPROCESSING_REQUIRED) {
     
//      System.out.println("\n\n performing TEXTBOX_POSTPROCESSING \n\n");
     
      DOMResult result = new DOMResult();
      org.docx4j.XmlUtils.transform(foDocumentSrc, xslt_POSTPROCESSING, null, result);   

      org.w3c.dom.Document docResult = ((org.w3c.dom.Document)result.getNode());
      String modifiedFO = XmlUtils.w3CDomNodeToString(docResult);
      log.debug("After moving! \n" + modifiedFO)
     
      foDocumentSrc = new StreamSource(new StringReader(modifiedFO));
     
    }

    StartEvent startEvent = new StartEvent( settings.getWmlPackage(), WellKnownProcessSteps.FOP_RENDER_PASS1 );
    startEvent.publish();
   
    render(fopFactory, apacheFopMime, foDocumentSrc, placeholderLookup, outputStream);
   
    new EventFinished(startEvent).publish();
  }
View Full Code Here


 
  private static void fixExtents(LayoutMasterSet lms, AbstractWmlConversionContext context, boolean useXSLT) {
   
    WordprocessingMLPackage wordMLPackage = context.getWmlPackage();

    StartEvent startEvent = new StartEvent( wordMLPackage, WellKnownProcessSteps.FO_EXTENTS );
    startEvent.publish();
   
//    log.debug(wordMLPackage.getMainDocumentPart().getXML());
   
    log.debug("incoming LMS: " + XmlUtils.marshaltoString(lms, Context.getXslFoContext()));
   
View Full Code Here

  /**
   *  Bind the content controls of the passed document to the xml.
   */ 
  public static void bind(WordprocessingMLPackage wmlPackage, InputStream xmlDocument, int flags) throws Docx4JException {
   
    StartEvent bindJobStartEvent = new StartEvent( WellKnownJobTypes.BIND, wmlPackage );
    bindJobStartEvent.publish();
   
    if (flags == FLAG_NONE) {
      //do everything
      flags = (FLAG_BIND_INSERT_XML |
           FLAG_BIND_BIND_XML |
View Full Code Here

      throw new Docx4JException("Couldn't find CustomXmlDataStoragePart! exiting..");
    }
 
    if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) {
     
      StartEvent startEvent = new StartEvent( WellKnownJobTypes.BIND, wmlPackage, WellKnownProcessSteps.BIND_INSERT_XML );
      startEvent.publish();
     
      insertXMLData(customXmlDataStoragePart, xmlDocument);
     
      new EventFinished(startEvent).publish();
    }
    if ((flags & FLAG_BIND_BIND_XML) == FLAG_BIND_BIND_XML) {
     
      StartEvent startEvent = new StartEvent( WellKnownJobTypes.BIND, wmlPackage, WellKnownProcessSteps.BIND_BIND_XML );
      startEvent.publish();
     
      if (wmlPackage.getMainDocumentPart().getXPathsPart()!=null) {
        openDoPEHandler = new OpenDoPEHandler(wmlPackage);
        openDoPEHandler.preprocess();
       
        bookmarkId = openDoPEHandler.getNextBookmarkId();
      }
      BindingHandler bh = new BindingHandler(wmlPackage);
      bh.setStartingIdForNewBookmarks(bookmarkId);
      bh.applyBindings();
     
      new EventFinished(startEvent).publish();
    }
    if ((flags & FLAG_BIND_REMOVE_SDT) == FLAG_BIND_REMOVE_SDT) {
     
      StartEvent startEvent = new StartEvent( WellKnownJobTypes.BIND, wmlPackage, WellKnownProcessSteps.BIND_REMOVE_SDT );
      startEvent.publish();

      removeSDTs(wmlPackage);
     
      new EventFinished(startEvent).publish();
    }
    if ((flags & FLAG_BIND_REMOVE_XML) == FLAG_BIND_REMOVE_XML) {
     
      StartEvent startEvent = new StartEvent( WellKnownJobTypes.BIND, wmlPackage, WellKnownProcessSteps.BIND_REMOVE_XML );
      startEvent.publish();
     
      removeDefinedCustomXmlParts(wmlPackage, customXmlDataStoragePart);
     
      new EventFinished(startEvent).publish();
    }
View Full Code Here

    if (pkgIdentifier==null) {
      pkgIdentifier = new PackageIdentifierTransient("pkg_" + System.currentTimeMillis());
    }
   
    StartEvent startEvent = new StartEvent( pkgIdentifier,  WellKnownProcessSteps.PKG_LOAD );
    startEvent.publish();     
   
    if (type.equals(Filetype.ZippedPackage)){
     
      final ZipPartStore partLoader = new ZipPartStore(is);
      final Load3 loader = new Load3(partLoader);
View Full Code Here

  /**
   *  Convenience method to convert the document to PDF
   */ 
  public static void toPDF(WordprocessingMLPackage wmlPackage, OutputStream outputStream) throws Docx4JException {
   
    StartEvent startEvent = new StartEvent( wmlPackage, WellKnownProcessSteps.PDF );
    startEvent.publish();
   
    FOSettings settings = createFOSettings();
    settings.setWmlPackage(wmlPackage);
    settings.setApacheFopMime("application/pdf");
    toFO(settings, outputStream, FLAG_NONE);
View Full Code Here

  
   *  @since 3.1.0
   */ 
  public void save(OutputStream outStream, int flags) throws Docx4JException {
   
    StartEvent startEvent = new StartEvent( this,  WellKnownProcessSteps.PKG_SAVE );
    startEvent.publish();
   
    if (flags == Docx4J.FLAG_SAVE_FLAT_XML) {
      JAXBContext jc = Context.jcXmlPackage;
      FlatOpcXmlCreator opcXmlCreator = new FlatOpcXmlCreator(this);
      org.docx4j.xmlPackage.Package pkg = opcXmlCreator.get();
View Full Code Here

  /**
   *  Convert the document to HTML
   */ 
  public static void toHTML(HTMLSettings settings, OutputStream outputStream, int flags) throws Docx4JException {

    StartEvent startEvent = new StartEvent( settings.getWmlPackage(), WellKnownProcessSteps.HTML_OUT );
    startEvent.publish();
   
    Exporter<HTMLSettings> exporter = getHTMLExporter(flags);
    exporter.export(settings, outputStream);
   
    new EventFinished(startEvent).publish();
View Full Code Here

  /**
   *  Convert the document to HTML
   */ 
  public static void toHTML(WordprocessingMLPackage wmlPackage, String imageDirPath, String imageTargetUri, OutputStream outputStream) throws Docx4JException {

    StartEvent startEvent = new StartEvent( wmlPackage, WellKnownProcessSteps.HTML_OUT );
    startEvent.publish();
   
    HTMLSettings settings = createHTMLSettings();
    settings.setWmlPackage(wmlPackage);
    if (imageDirPath != null) {
      settings.setImageDirPath(imageDirPath);
View Full Code Here

  }
 
  @Override
  public void process(CS conversionSettings, CC conversionContext, OutputStream outputStream) throws Docx4JException {
   
    StartEvent startEvent = new StartEvent( conversionSettings.getWmlPackage(), WellKnownProcessSteps.OUT_XsltExporterDelegate );
    startEvent.publish();   
   
    Document domDoc = getSourceDocument(conversionSettings, conversionContext);
    Templates templates = getTemplates(conversionSettings, conversionContext);
    Result intermediateResult = new StreamResult(outputStream);
    XmlUtils.transform(domDoc, templates, conversionContext.getXsltParameters(), intermediateResult);
View Full Code Here

TOP

Related Classes of org.docx4j.events.StartEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.