Ignore:
Timestamp:
09/06/11 15:22:09 (9 months ago)
Author:
jharrop
Message:

save the comparison output as pdf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/samples/CompareDocuments.java

    r1168 r1654  
    3232import javax.xml.bind.Unmarshaller; 
    3333 
     34import org.docx4j.convert.out.pdf.viaXSLFO.PdfSettings; 
    3435import org.docx4j.diff.Differencer; 
    3536import org.docx4j.fonts.IdentityPlusMapper; 
     
    6061        public static void main(String[] args) throws Exception { 
    6162 
    62                 String newerfilepath = "/home/dev/workspace/docx4j/sample-docs/differencing_newer.docx"; 
    63                 String olderfilepath = "/home/dev/workspace/docx4j/sample-docs/differencing_older.docx"; 
     63                String newerfilepath = System.getProperty("user.dir") + "/102.docx"; 
     64                String olderfilepath = System.getProperty("user.dir") + "/103.docx"; 
    6465                                                 
    6566                // 1. Load the Packages 
     
    6970                Body newerBody = ((Document)newerPackage.getMainDocumentPart().getJaxbElement()).getBody(); 
    7071                Body olderBody = ((Document)olderPackage.getMainDocumentPart().getJaxbElement()).getBody(); 
     72                 
     73                System.out.println("Differencing.."); 
    7174                 
    7275                // 2. Do the differencing 
     
    101104                        = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(newerPackage); 
    102105 
    103 //              c.view(); 
     106                OutputStream os = new java.io.FileOutputStream(System.getProperty("user.dir") +  "/COMPARED.pdf");                       
     107                c.output(os, new PdfSettings() ); 
     108                System.out.println("Saved " + System.getProperty("user.dir") +  "/COMPARED.pdf"); 
    104109                                 
    105110        } 
Note: See TracChangeset for help on using the changeset viewer.