Exemple #1
0
 function connect()
 {
     //db username and password
     $host = 'localhost:3306';
     $dbname = 'zakila';
     $username = '******';
     $password = '';
     $report = $this->compileReporte();
     $fillManager = new \JavaClass("net.sf.jasperreports.engine.JasperFillManager");
     $params = new \Java("java.util.HashMap");
     $params->put("REPORT_LOCALE", $this->convertValue("en_US", "java.util.Locale"));
     if (!empty($this->parametros)) {
         foreach ($this->parametros as $key => $value) {
             $params->put($key, $value);
         }
     }
     $class = new \JavaClass("java.lang.Class");
     $class->forName("com.mysql.jdbc.Driver");
     $driverManager = new \JavaClass("java.sql.DriverManager");
     try {
         $conn = $driverManager->getConnection("jdbc:mysql://{$host}/{$dbname}?zeroDateTimeBehavior=convertToNull", $username, $password);
         $jasperPrint = $fillManager->fillReport($report, $params, $conn);
     } catch (\JavaException $ex) {
         echo $ex->getCause();
     }
     $this->jasperPrint = $jasperPrint;
 }
 public static function autoFitTableToFixedColumnWidths($dataDir)
 {
     //ExStart
     //ExFor:Table.AutoFit
     //ExFor:AutoFitBehavior
     //ExId:DisableAutoFitAndUseFixedWidths
     //ExSummary:Disables autofitting and enables fixed widths for the specified table.
     // Open the document
     $doc = new Java("com.aspose.words.Document", $dataDir . "TestFile.doc");
     $nodeType = new Java("com.aspose.words.NodeType");
     $table = $doc->getChild($nodeType->TABLE, 0, true);
     // Disable autofitting on this table.
     $autoFitBehavior = new Java("com.aspose.words.AutoFitBehavior");
     $table->autoFit($autoFitBehavior->AUTO_FIT_TO_CONTENTS);
     // Save the document to disk.
     $doc->save($dataDir . "TestFile.FixedWidth Out.doc");
     //ExEnd
     $preferredWidthType = new Java("com.aspose.words.PreferredWidthType");
     if (java_values($doc->getFirstSection()->getBody()->getTables()->get(0)->getPreferredWidth()->getType()) == java_values($preferredWidthType->AUTO)) {
         echo "PreferredWidth type is not auto <br />";
     }
     if (java_values($doc->getFirstSection()->getBody()->getTables()->get(0)->getPreferredWidth()->getValue()) == 0) {
         echo "PreferredWidth value is not 0 <br />";
     }
     if (java_values($doc->getFirstSection()->getBody()->getTables()->get(0)->getFirstRow()->getFirstCell()->getCellFormat()->getWidth()) == 0) {
         echo "Cell width is not correct. <br />";
     }
 }
 public static function saveToDisk()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/quickstart/loadandsavetodisk/data/";
     // Load the document from the absolute path on disk.
     $doc = new Java("com.aspose.words.Document", $dataDir . "Document.doc");
     // Save the document as DOCX document.");
     $doc->save($dataDir . "Document Out.docx");
 }
 public static function mailmerge()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/quickstart/simplemailmerge/data/";
     $doc = new Java("com.aspose.words.Document", $dataDir . "Template.doc");
     // Fill the fields in the document with user data.
     $doc->getMailMerge()->execute(array("FullName", "Company", "Address", "Address2", "City"), array("James Bond", "MI5 Headquarters", "Milbank", "", "London"));
     // Saves the document to disk.
     $doc->save($dataDir . "MailMerge Result Out.docx");
 }
 public static function main()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/programmingwithdocuments/workingwithfields/insertnestedfields/data/";
     $doc = new Java("com.aspose.words.Document");
     // Document();
     $builder = new Java("com.aspose.words.DocumentBuilder", $doc);
     // DocumentBuilder(doc);
     // Insert few page breaks (just for testing)
     $breakType = Java("com.aspose.words.BreakType");
     for ($i = 0; $i < 5; $i++) {
         $builder->insertBreak($breakType->PAGE_BREAK);
     }
     // Move DocumentBuilder cursor into the primary footer.
     $headerFooterType = Java("com.aspose.words.HeaderFooterType");
     $builder->moveToHeaderFooter($headerFooterType->FOOTER_PRIMARY);
     // We want to insert a field like this:
     // { IF {PAGE} <> {NUMPAGES} "See Next Page" "Last Page" }
     $field = $builder->insertField("IF ");
     $builder->moveTo($field->getSeparator());
     $builder->insertField("PAGE");
     $builder->write(" <> ");
     $builder->insertField("NUMPAGES");
     $builder->write(" \"See Next Page\" \"Last Page\" ");
     // Finally update the outer field to recalcaluate the final value. Doing this will automatically update
     // the inner fields at the same time.
     $field->update();
     $doc->save($dataDir . "InsertNestedFields Out.docx");
 }
 function init()
 {
     $SWT = new JavaClass("org.eclipse.swt.SWT");
     $shell = $this->shell = new java("org.eclipse.swt.widgets.Shell");
     $shell->setSize(320, 200);
     $shell->setLayout(new java("org.eclipse.swt.layout.FillLayout"));
     $button = new Java("org.eclipse.swt.widgets.Button", $this->shell, $SWT->PUSH);
     $button->setText("Click here.");
     $button->addSelectionListener(java_closure($this, null, java("org.eclipse.swt.events.SelectionListener")));
     $this->shell->open();
 }
 public static function AppendDocs()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/quickstart/appenddocuments/data/";
     // Load the destination and source documents from disk.
     $dstDocObject = new Java("com.aspose.words.Document", $dataDir . "TestFile.Destination.doc");
     $srcDocObject = new Java("com.aspose.words.Document", $dataDir . "TestFile.Source.doc");
     $importFormatModeObject = new java('com.aspose.words.ImportFormatMode');
     $sourceFormating = $importFormatModeObject->KEEP_SOURCE_FORMATTING;
     // Append the source document to the destination document while keeping the original formatting of the source document.
     $dstDocObject->appendDocument(java_values($srcDocObject), java_values($sourceFormating));
     $dstDocObject->save($dataDir . "TestFile_Out.docx");
 }
 public static function apply()
 {
     // This line attempts to set a license from several locations relative to the executable and Aspose.Words.dll.
     // You can also use the additional overload to load a license from a stream, this is useful for instance when the
     // license is stored as an embedded resource
     try {
         $license = new Java('com.aspose.words.License');
         $license->setLicense("Aspose.Words.lic");
     } catch (Exception $e) {
         // We do not ship any license with this example, visit the Aspose site to obtain either a temporary or permanent license.
         echo "There was an error setting the license:" . $e->getMessage();
     }
 }
 public static function main()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/programmingwithdocuments/workingwithfields/removefield/data/";
     $doc = new Java("com.aspose.words.Document", $dataDir . "Field.RemoveField.doc");
     //ExStart
     //ExFor:Field.Remove
     //ExId:DocumentBuilder_RemoveField
     //ExSummary:Removes a field from the document.
     $field = $doc->getRange()->getFields()->get(0);
     // Calling this method completely removes the field from the document.
     $field->remove();
     //ExEnd
 }
 public static function main()
 {
     // Create a new document.
     $doc = new Java("com.aspose.words.Document");
     // Creates and adds a paragraph node to the document.
     $para = new Java("com.aspose.words.Paragraph", $doc);
     // Typed access to the last section of the document.
     $section = $doc->getLastSection();
     $section->getBody()->appendChild($para);
     // Next print the node type of one of the nodes in the document.
     $nodeType = $doc->getFirstSection()->getBody()->getNodeType();
     $node = new Java("com.aspose.words.Node");
     echo "NodeType: " . $node->nodeTypeToString($nodeType);
 }
 function run()
 {
     $name = java_values(java_context()->getAttribute("name", 100));
     // engine scope
     $out = new Java("java.io.FileOutputStream", "{$name}.out", true);
     $Thread = java("java.lang.Thread");
     $nr = java_values(java_context()->getAttribute("nr", 100));
     echo "started thread: {$nr}\n";
     for ($i = 0; $i < 10; $i++) {
         $out->write(ord("{$nr}"));
         $Thread->yield();
     }
     $out->close();
 }
 public static function printHelloWorld()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/quickstart/helloworld/data/";
     // Create a blank document.
     $documentObject = new Java("com.aspose.words.Document");
     // DocumentBuilder provides members to easily add content to a document.
     $builderBoject = new Java("com.aspose.words.DocumentBuilder", $documentObject);
     // Write a new paragraph in the document with the text "Hello World!"
     $builderBoject->writeln("Hello World!");
     // Save the document in DOCX format. The format to save as is inferred from the extension of the file name.
     // Aspose.Words supports saving any document in many more formats.
     $documentObject->save($dataDir . "HelloWorld.docx");
 }
 public static function replaceText()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/quickstart/findandreplace/data/";
     // Open the document.
     $doc = new Java("com.aspose.words.Document", $dataDir . "ReplaceSimple.doc");
     // Check the text of the document
     echo "Original document text: " . $doc->getRange()->getText() . "<BR>";
     // Replace the text in the document.
     $doc->getRange()->replace("_CustomerName_", "James Bond", false, false);
     // Check the replacement was made.
     echo "Document text after replace: " . $doc->getRange()->getText();
     // Save the modified document.
     $doc->save($dataDir . "ReplaceSimple Out.doc");
 }
 public static function runsByStyleName($doc, $styleName)
 {
     // Create an array to collect runs of the specified style.
     $runsWithStyle = new Java("java.util.ArrayList");
     // Get all runs from the document.
     $nodeType = Java("com.aspose.words.NodeType");
     $runs = $doc->getChildNodes($nodeType->RUN, true);
     // Look through all runs to find those with the specified style.
     $runs = $runs->toArray();
     foreach ($runs as $run) {
         if (java_values($run->getFont()->getStyle()->getName()->equals($styleName))) {
             $runsWithStyle->add($run);
         }
     }
     return $runsWithStyle;
 }
 function get()
 {
     echo "hello Java Handler here";
     $CA = new Java("calculator.CalculatorBean");
     $session = java_session();
     if (is_null(java_values($calcinstance = $session->get("calculatorInstance")))) {
         $session->put("calculatorInstance", $calcinstance = new Java("calculator.CalculatorBean"));
     }
     echo "<br>after calcultator";
     echo "<br>session from java = " . java_values($calcinstance = $session->get("calculatorInstance"));
     if (eregi('^/java/rpc/*', $_SERVER['REQUEST_URI'])) {
         $RPC = new Java("rpc.test.RpcConsumer");
         $RPC->test();
         echo "<br> RPC Service on 8082 ";
     }
 }
 private function insertWatermarkText($doc, $watermarkText)
 {
     // Create a watermark shape. This will be a WordArt shape.
     // You are free to try other shape types as watermarks.
     $shapeType = new Java("com.aspose.words.ShapeType");
     $watermark = new Java("com.aspose.words.Shape", $doc, $shapeType->TEXT_PLAIN_TEXT);
     // Set up the text of the $watermark->
     $watermark->getTextPath()->setText($watermarkText);
     $watermark->getTextPath()->setFontFamily("Arial");
     $watermark->setWidth(500);
     $watermark->setHeight(100);
     // Text will be directed from the bottom-left to the top-right corner.
     $watermark->setRotation(-40);
     // Remove the following two lines if you need a solid black text.
     $color = new Java("java.awt.Color");
     $watermark->getFill()->setColor($color->GRAY);
     // Try LightGray to get more Word-style watermark
     $watermark->setStrokeColor($color->GRAY);
     // Try LightGray to get more Word-style watermark
     // Place the watermark in the page center.
     $relativeHorizontalPosition = new Java("com.aspose.words.RelativeHorizontalPosition");
     $watermark->setRelativeHorizontalPosition($relativeHorizontalPosition->PAGE);
     $watermark->setRelativeVerticalPosition($relativeHorizontalPosition->PAGE);
     $wrapType = new Java("com.aspose.words.WrapType");
     $watermark->setWrapType($wrapType->NONE);
     $verticalAlignment = new Java("com.aspose.words.VerticalAlignment");
     $watermark->setVerticalAlignment($verticalAlignment->CENTER);
     $horizontalAlignment = new Java("com.aspose.words.HorizontalAlignment");
     $watermark->setHorizontalAlignment($horizontalAlignment->CENTER);
     // Create a new paragraph and append the watermark to this paragraph.
     $watermarkPara = new Java("com.aspose.words.Paragraph", $doc);
     $watermarkPara->appendChild($watermark);
     $sects = $doc->getSections()->toArray();
     // Insert the watermark into all headers of each document section.
     foreach ($sects as $sect) {
         $headerFooterType = new Java("com.aspose.words.HeaderFooterType");
         // There could be up to three different headers in each section, since we want
         // the watermark to appear on all pages, insert into all headers.
         $this->insertWatermarkIntoHeader($watermarkPara, $sect, $headerFooterType->HEADER_PRIMARY);
         $this->insertWatermarkIntoHeader($watermarkPara, $sect, $headerFooterType->HEADER_FIRST);
         $this->insertWatermarkIntoHeader($watermarkPara, $sect, $headerFooterType->HEADER_EVEN);
     }
 }
 public static function saveToStream()
 {
     // The path to the documents directory.
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/quickstart/loadandsavetostream/data/";
     // Open the stream. Read only access is enough for Aspose.Words to load a document.
     $stream = new Java("java.io.FileInputStream", $dataDir . "Document.doc");
     // Load the entire document into memory.
     $doc = new Java("com.aspose.words.Document", $stream);
     // You can close the stream now, it is no longer needed because the document is in memory.
     $stream->close();
     // ... do something with the document
     // Convert the document to a different format and save to stream.
     $dstStream = new Java("java.io.ByteArrayOutputStream");
     $SaveFormat = new Java("com.aspose.words.SaveFormat");
     $doc->save($dstStream, $SaveFormat->RTF);
     $output = new Java("java.io.FileOutputStream", $dataDir . "Document Out.rtf");
     $output->write($dstStream->toByteArray());
     $output->close();
 }
Exemple #18
0
Fichier : FOP.php Projet : jasny/Q
 /**
  * Call Apache FOP from PHP and return the result
  *
  * @param string  $data File path
  * @return string
  */
 public function process($data = null)
 {
     if (!file_exists($this->file) || !is_file($this->file)) {
         throw new Exception("Unable to start the PHP file transformation : File '" . $this->file . "' does not exist, is not accessable (check permissions) or is not a regular file.");
     }
     if (!is_file($data)) {
         throw new Exception("Unable to start the file transformation : The param specified with 'process' method is not a file.");
     }
     $options = array($data, $this->file);
     $this->startErrorHandler();
     ob_start();
     $java = new Java("org.apache.fop.apps.CommandLine", $options);
     // it should be org.apache.fop.cli.CommandLine or org.apache.fop.cli.CommandLineOptions ???
     $java->run();
     $contents = ob_get_contents();
     ob_end_clean();
     $this->stopErrorHandler();
     return $contents;
 }
Exemple #19
0
function procesaXmlV32($factura, &$resultado)
{
    global $SITE_URL, $KEYS_DIR;
    //,$CODIFICACION_UTF8,$DECODIFICACION_UTF8,$CODIFICACION_XML_UTF8, $DECODIFICACION_XML_UTF8;
    $xml = "";
    $resultado = array();
    //version sat 3.2
    $xml = domSATV32($factura);
    if ($xml == null) {
        log_action("ERROR GENERANDO XML ", 0);
        return -1;
    }
    $codifxml = mb_detect_encoding($xml, 'UTF-8', true);
    $cadenaOriginal = cadenaSATV3_2($xml);
    //Version cfdi
    $codifCadena = mb_detect_encoding($cadenaOriginal, 'UTF-8', true);
    if ($codifxml != 'UTF-8' || $codifCadena != 'UTF-8') {
        $msg = "codificacon utf8 invalida ";
        log_action($msg);
        $resultado['error'] = $msg;
        return -1;
    }
    $resultado['cadena'] = $cadenaOriginal;
    //SELLO
    $facej = new Java('cc.lab.SignatureMgmt');
    $pkeyfile = $SITE_URL . $KEYS_DIR . $factura->sello['llavedec'];
    $sello = $facej->sign($cadenaOriginal, $pkeyfile);
    log_action(print_r("***********************  S E L L O **********************", TRUE));
    log_action($cadenaOriginal);
    log_action(print_r($pkeyfile, TRUE));
    if (!(strpos($sello, "ERROR") === false)) {
        log_action("ERROR GENERANDO SELLO: " . $sello, 0);
        $resultado['error'] = "ERROR GENERANDO SELLO: " . $sello;
        return -1;
    }
    $xml = str_replace("%SELLO%", $sello, $xml);
    $resultado['sello'] = $sello;
    $XMLBODY = $xml;
    $resultado['xmlutf8'] = $XMLBODY;
    $resultado['xml'] = $xml;
    return 0;
}
Exemple #20
0
 function search($pQuery)
 {
     global $gBitSystem;
     $this->mResults = array();
     $this->mHits = 0;
     if (!empty($pQuery) && $this->verifySearchIndex()) {
         parent::search($pQuery);
         // use java wddx
         $query = $pQuery;
         java_require(LUCENE_PKG_PATH . 'indexer/lucene.jar;' . LUCENE_PKG_PATH . 'indexer');
         $obj = new Java("org.bitweaver.lucene.SearchEngine");
         $result = $obj->search($this->getField('index_path'), "OR", $query, $this->getField('index_fields'));
         if ($meta = $result->get('meta_data')) {
             $this->mHits = (string) $meta->get('hits');
         } else {
             $this->mHits = 0;
         }
         $this->mResults = $result->get('rows');
     }
     return count($this->mResults);
 }
Exemple #21
0
 public function __construct($storage, $transport, $repository = null)
 {
     /*    $this->JRrepository = new Java("org.apache.jackrabbit.rmi.repository.URLRemoteRepository","http://localhost:8080/rmi");
     	    return;
     */
     if (isset($repository)) {
         $this->JRrepository = $repository;
     } else {
         if ($transport == 'webdav') {
             $factory = new java("com.day.crx.jcr.davex.Client", $storage);
             $this->JRrepository = $factory->getRepository();
         } else {
             if ($transport == 'davex') {
                 $client = new java("ch.liip.jcr.davex.DavexClient", $storage);
                 $this->JRrepository = $client->getRepository();
             } else {
                 $factory = new Java("org.apache.jackrabbit.rmi.client.ClientRepositoryFactory");
                 $this->JRrepository = $factory->getRepository($storage);
             }
         }
     }
 }
function management_form()
{
    global $users;
    $user_names = $_REQUEST['user_names'];
    $user_digests = $_REQUEST['user_digests'];
    for ($i = 0; $i < count($user_names); $i++) {
        $name = $user_names[$i];
        $user = array(name => $name, digest => $user_digests[$i]);
        $users[$name] = $user;
    }
    if ($_REQUEST['admin_name'] && $_REQUEST['admin_password']) {
        $name = $_REQUEST['admin_name'];
        $password = $_REQUEST['admin_password'];
        $passwordDigest = new Java("com.caucho.server.security.PasswordDigest");
        $digest = $passwordDigest->getPasswordDigest($name, $password, "resin");
        $users[$name] = array(name => $name, digest => $digest);
    }
    echo "<h2>Management</h2>\n";
    echo "<table>";
    echo "<tr><th align='left'>name</th>";
    echo "<th align='left'>password</th><th></th></tr>";
    foreach ($users as $user) {
        $name = $user['name'];
        $digest = $user['digest'];
        echo "<input type='hidden' name='user_names[]' value='{$name}'>";
        echo "<input type='hidden' name='user_digests[]' value='{$digest}'>";
        echo "<tr>";
        echo "  <td>{$name}</td>";
        echo "  <td>******</td>";
        echo "  <td><input type='submit' name='admin_delete_{$name}' value='delete'></td>";
        echo "</tr>";
    }
    echo "<tr>";
    echo "  <td><input name='admin_name' size='20'></td>";
    echo "  <td><input name='admin_password' type='password' size='20'></td>";
    echo "  <td><input type='submit' name='admin_add' value='add'></td>";
    echo "</tr>";
    echo "</table>";
}
 public static function main()
 {
     $dataDir = "/usr/local/apache-tomcat-8.0.22/webapps/JavaBridge/Aspose_Words_Java_For_PHP/src/programmingwithdocuments/workingwithbookmarks/copybookmarkedtext/data/";
     // Load the source document.
     $srcDoc = new Java("com.aspose.words.Document", $dataDir . "Template.doc");
     // This is the bookmark whose content we want to copy.
     $srcBookmark = $srcDoc->getRange()->getBookmarks()->get("ntf010145060");
     // We will be adding to this document.
     $dstDoc = new Java("com.aspose.words.Document");
     // Let's say we will be appending to the end of the body of the last section.
     $dstNode = $dstDoc->getLastSection()->getBody();
     // It is a good idea to use this import context object because multiple nodes are being imported.
     // If you import multiple times without a single context, it will result in many styles created.
     $importFormatMode = java('com.aspose.words.ImportFormatMode');
     $importer = new Java("com.aspose.words.NodeImporter", $srcDoc, $dstDoc, $importFormatMode->KEEP_SOURCE_FORMATTING);
     // Do it once.
     CopyBookmarkedText::appendBookmarkedText($importer, $srcBookmark, $dstNode);
     // Do it one more time for fun.
     CopyBookmarkedText::appendBookmarkedText($importer, $srcBookmark, $dstNode);
     // Save the finished document.
     $dstDoc->save($dataDir . "Template Out.doc");
 }
 /**
  * This method is called by the Aspose.Words find and replace engine for each match.
  * This method highlights the match string, even if it spans multiple runs.
  */
 public static function replacing($e)
 {
     // This is a Run node that contains either the beginning or the complete match.
     $currentNode = $e->getMatchNode();
     // The first (and may be the only) run can contain text before the match,
     // in this case it is necessary to split the run.
     if (java_values($e->getMatchOffset()) > 0) {
         $currentNode = ReplaceEvaluatorFindAndHighlight::splitRun($currentNode, $e->getMatchOffset());
     }
     // This array is used to store all nodes of the match for further highlighting.
     $runs = new Java("java.util.ArrayList");
     // Find all runs that contain parts of the match string.
     $remainingLength = $e->getMatch()->group()->length();
     while (java_values($remainingLength) > 0 && java_values($currentNode) != null && java_values($currentNode->getText()->length()) <= java_values($remainingLength)) {
         $runs->add($currentNode);
         $remainingLength = java_values($remainingLength) - java_values($currentNode->getText()->length());
         // Select the next Run node.
         // Have to loop because there could be other nodes such as BookmarkStart etc.
         do {
             $currentNode = $currentNode->getNextSibling();
             $nodeType = Java("com.aspose.words.NodeType");
         } while (java_values($currentNode) != null && java_values($currentNode->getNodeType()) != java_values($nodeType->RUN));
     }
     // Split the last run that contains the match if there is any text left.
     if (java_values($currentNode) != null && java_values($remainingLength) > 0) {
         ReplaceEvaluatorFindAndHighlight::splitRun($currentNode, $remainingLength);
         $runs->add($currentNode);
     }
     // Now highlight all runs in the sequence.
     $runs = $runs->toArray();
     $color = Java("java.awt.Color");
     foreach ($runs as $run) {
         $run->getFont()->setHighlightColor('yellow');
     }
     // Signal to the replace engine to do nothing because we have already done all what we wanted.
     $replaceAction = Java("com.aspose.words.ReplaceAction");
     return $replaceAction->SKIP;
 }
 public static function extractComments()
 {
     $args = func_get_args();
     $doc = $args[0];
     $collectedComments = new Java("java.util.ArrayList");
     // Collect all comments in the document
     $nodeType = Java("com.aspose.words.NodeType");
     $comments = $doc->getChildNodes($nodeType->COMMENT, true)->toArray();
     //echo "<PRE>"; echo java_inspect($comments); exit;
     // Look through all comments and gather information about them.
     $saveFormat = Java("com.aspose.words.SaveFormat");
     foreach ($comments as $comment) {
         if (isset($args[1]) && !empty($args[1])) {
             $authorName = $args[1];
             if (java_values($comment->getAuthor()->equals(authorName))) {
                 $collectedComments->add($comment->getAuthor() . " " . $comment->getDateTime() . " " . $comment->toString($saveFormat->TEXT));
             }
         } else {
             $collectedComments->add($comment->getAuthor() . " " . $comment->getDateTime() . " " . $comment->toString($saveFormat->TEXT));
         }
     }
     return $collectedComments;
 }
 /**
  * @param $path
  * @return Java object Input Stream
  */
 public function createJavaInputStream($path)
 {
     $handle = fopen($path, "r");
     $contents = fread($handle, filesize($path));
     fclose($handle);
     $out = new Java("java.io.ByteArrayOutputStream");
     $arr = array();
     $strlen = strlen($contents);
     for ($i = 0; $i < $strlen; $i++) {
         $val = ord(substr($contents, $i, 1));
         if ($val >= 128) {
             $val = $val - 256;
         }
         $arr[] = $val;
     }
     $out->write($arr);
     $value = new Java("java.io.ByteArrayInputStream", $out->toByteArray());
     return $value;
 }
Exemple #27
0
<?php 
$ip = $_SERVER['SERVER_NAME'];
//获取本机IP
require_once "http://" . $ip . ":8080/JavaBridge/java/Java.inc";
//此行必须
$fs = new Java("com.zhuozhengsoft.pageoffice.FileSaverPHP");
//此行必须
$fs->load(file_get_contents("php://input"));
//此行必须
java_set_file_encoding("GBK");
//设置编码格式
//获取通过Url传递过来的值
$id = 0;
$id = $_REQUEST["id"];
$filepath = dirname($_SERVER["SCRIPT_FILENAME"]);
$fs->saveToFile($filepath . "/page/" . $id . "/" . $fs->getFileName());
//保存文件
echo $fs->close();
//此行必须
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'SaveFile.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
         //$iSize = file_put_contents ( $pathOutput .  $sFilename . '.pdf' , $content );
         copy($outputFile, $pathOutput . $sFilename . '.pdf');
         //die;
         break;
     case 'ACROFORM':
         //creating the xml with the application data;
         $xmlData = "<dynaform>\n";
         foreach ($Fields['APP_DATA'] as $key => $val) {
             $xmlData .= "  <{$key}>{$val}</{$key}>\n";
         }
         $xmlData .= "</dynaform>\n";
         //$iSize = file_put_contents ( $javaOutput .  'addressBook.xml' , $xmlData );
         G::LoadClass('javaBridgePM');
         $JBPM = new JavaBridgePM();
         $JBPM->checkJavaExtension();
         $util = new Java("com.processmaker.util.pmutils");
         $util->setInputPath($javaInput);
         $util->setOutputPath($javaOutput);
         copy(PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.pdf', $javaInput . $aOD['OUT_DOC_UID'] . '.pdf');
         $outputFile = $javaOutput . $sFilename . '.pdf';
         print $util->writeVarsToAcroFields($aOD['OUT_DOC_UID'] . '.pdf', $xmlData);
         copy($javaOutput . $aOD['OUT_DOC_UID'] . '.pdf', $pathOutput . $sFilename . '.pdf');
         break;
     default:
         throw new Exception('invalid output document');
 }
 //Execute after triggers - Start
 $Fields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], 'OUTPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA']);
 $Fields['DEL_INDEX'] = $_SESSION['INDEX'];
 $Fields['TAS_UID'] = $_SESSION['TASK'];
 //Execute after triggers - End
Exemple #29
0
 function ChargeRecurring($client_id, $gateway, $order_id, $token, $amount)
 {
     $CI =& get_instance();
     if (empty($token)) {
         $response['reason'] = 'Token not passed to ChargeRecurring.';
         $response['success'] = FALSE;
         return $response;
     }
     if (!isset($this->object_loaded)) {
         $this->loadObject($gateway);
     }
     $tran = new Java("com.edgil.ecco.eccoapi.MonetaryTransactionData");
     $tran->setMerchantId($gateway['merchant_id']);
     $tran->setOEPId($gateway['oep_id']);
     $this->ECCOClient->certifyECCO($this->pass, $this->pass, $this->alias, "ECCO");
     $status = $this->ECCOClient->logon($gateway['login_id'], $gateway['password']);
     if ($status != $this->ECCOStatusCodes->SUCCESS) {
         $response = $CI->response->TransactionResponse(2, array('reason' => 'Login Error'));
         return $response;
     }
     $tran->setToken($token);
     $tran->setTransactionId($order_id);
     $tran->setAmount($amount);
     $status = $this->ECCOClient->requestAuthorization($tran);
     if ($status == $this->ECCOStatusCodes->SUCCESS) {
         $CI->load->model('order_authorization_model');
         $CI->order_authorization_model->SaveAuthorization($order_id, '', "'" . $tran->getAuthorizationCode() . "'");
         $CI->charge_model->SetStatus($order_id, 1);
         $status = $this->ECCOClient->requestMarkForCapture($tran);
         $response['success'] = TRUE;
     } else {
         $response['success'] = FALSE;
     }
     $this->ECCOClient->logoff();
     return $response;
 }
Exemple #30
0
<html>
<?

  $system = new Java("java.lang.System");
  print "Java version=".$system->getProperty("java.version")." <br>\n";
  print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
  print "OS=".$system->getProperty("os.name")." ".
	      $system->getProperty("os.version")." on ".
	      $system->getProperty("os.arch")." <br>\n";

  $formatter = new Java("java.text.SimpleDateFormat",
			"EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");

  print $formatter->format(new Java("java.util.Date"))."\n";

?>
</html>