本文整理汇总了PHP中java_values函数的典型用法代码示例。如果您正苦于以下问题:PHP java_values函数的具体用法?PHP java_values怎么用?PHP java_values使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了java_values函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run($dataDir = null)
{
# initialize barcode reader
$img = $dataDir . "barcode.jpg";
$barcode_reader_type = new BarCodeReadType();
$reader = new BarCodeReader($img, $barcode_reader_type->Code39Standard);
# Try to recognize all possible barcodes in the image
while (java_values($reader->read())) {
# Display the symbology type
print "BarCode Type: " . (string) $reader->getReadType() . PHP_EOL;
# Display the codetext
print "BarCode CodeText: " . (string) $reader->getCodeText() . PHP_EOL;
# Get the barcode region
$region = $reader->getRegion();
if ($region != null) {
# Initialize an object of type BufferedImage to get the Graphics object
$imageIO = new ImageIO();
// $file=new File();
$bufferedImage = $imageIO->read(new File($img));
# Initialize graphics object from the image
$g = $bufferedImage->getGraphics();
$color = new Color();
# Initialize paint object
$p = new GradientPaint(0, 0, $color->red, 100, 100, $color->pink, true);
$region->drawBarCodeEdges($g, $color->RED);
# Save the image
$imageIO->write($bufferedImage, "png", new File($dataDir . "Code39StdOut.png"));
}
}
# Close reader
$reader->close();
}
示例2: SplitDocumentToPages
public static function SplitDocumentToPages(File $docName)
{
$folderName = $docName->getParent();
$fileName = $docName->getName();
$extensionName = $fileName->substring($fileName->lastIndexOf("."));
$outFolder_obj = new File($folderName, "Out");
$outFolder = $outFolder_obj->getAbsolutePath();
echo "<BR> Processing document: " . $fileName . $extensionName;
$doc = new Document($docName->getAbsolutePath());
// Create and attach collector to the document before page layout is built.
$layoutCollector = new LayoutCollector(doc);
// This will build layout model and collect necessary information.
$doc->updatePageLayout();
// Split nodes in the document into separate pages.
$splitter = new DocumentPageSplitter($layoutCollector);
// Save each page to the disk as a separate document.
for ($page = 1; $page <= java_values($doc->getPageCount()); $page++) {
$pageDoc = $splitter->GetDocumentOfPage($page);
$file_obj = new File($outFolder, MessageFormat::format("{0} - page{1} Out{2}", $fileName, $page, $extensionName));
$abs_path = $file_obj->getAbsolutePath();
$pageDoc->save($abs_path);
}
// Detach the collector from the document.
$layoutCollector->setDocument(null);
}
示例3: run
public static function run($dataDir = null)
{
$img = $dataDir . "barcode.jpg";
# initialize barcode reader
$barcode_reader_type = new BarCodeReadType();
$reader = new BarCodeReader($img, $barcode_reader_type->Code39Standard);
# Call read method
$reader->read();
# Now get all possible barcodes
$barcodes = $reader->getAllPossibleBarCodes();
$i = 0;
while (java_values($i < strlen($barcodes))) {
# Display code text, symbology, detected angle, recognition percentage of the barcode
print "Code Text: " . (string) $barcodes[$i]->getCodetext() . " Symbology: " . (string) $barcodes[$i]->getBarCodeReadType() . " Recognition percentage: " . (string) $barcodes[$i]->getAngle() . PHP_EOL;
# Display x and y coordinates of barcode detected
$point = $barcodes[$i]->getRegion()->getPoints();
print "Top left coordinates: X = " . (string) $point[0]->getX() . ", Y = " . (string) $point[0]->getY() . PHP_EOL;
print "Bottom left coordinates: X = " . (string) $point[1]->getX() . ", Y = " . (string) $point[1]->getY() . PHP_EOL;
print "Bottom right coordinates: X = " . (string) $point[2]->getX() . ", Y = " . (string) $point[2]->getY() . PHP_EOL;
print "Top right coordinates: X = " . (string) $point[3]->getX() . ", Y = " . (string) $point[3]->getY() . PHP_EOL;
break;
}
# Close reader
$reader->close();
}
示例4: removeComments
public static function removeComments()
{
$args = func_get_args();
$doc = $args[0];
if (isset($args[1]) && !empty($args[1])) {
$authorName = $args[1];
}
// Collect all comments in the document
$nodeType = Java("com.aspose.words.NodeType");
$comments = $doc->getChildNodes($nodeType->COMMENT, true);
$comments_count = $comments->getCount();
// Look through all comments and remove those written by the authorName author.
$i = $comments_count;
$i = $i - 1;
while ($i >= 0) {
$comment = $comments->get($i);
//echo "<PRE>"; echo java_inspect($comment); exit;
if (isset($authorName)) {
if (java_values($comment->getAuthor()->equals($authorName))) {
$comment->remove();
}
} else {
$comment->remove();
}
$i--;
}
}
示例5: main
public static function main()
{
echo "<pre>";
self::printTime("initializing...");
self::clearDir(self::$NEO4J_DB, false);
self::$neo = new java("org.neo4j.kernel.EmbeddedGraphDatabase", self::$NEO4J_DB);
self::$neo->shutdown();
self::printTime("clean db created");
self::$inserter = new java("org.neo4j.kernel.impl.batchinsert.BatchInserterImpl", self::$NEO4J_DB);
self::createChildren(self::$inserter->getReferenceNode(), 10, 1);
self::$inserter->shutdown();
self::printTime("nodes created");
self::$neo = new java("org.neo4j.kernel.EmbeddedGraphDatabase", self::$NEO4J_DB);
for ($i = 0; $i < 10; $i++) {
echo "\ntraversing through all nodes and counting depthSum...";
$tx = self::$neo->beginTx();
$traverser = self::$neo->getReferenceNode()->traverse(java('org.neo4j.graphdb.Traverser$Order')->BREADTH_FIRST, java('org.neo4j.graphdb.StopEvaluator')->END_OF_GRAPH, java('org.neo4j.graphdb.ReturnableEvaluator')->ALL_BUT_START_NODE, java('org.neo4j.graphdb.DynamicRelationshipType')->withName('PARENT'), java('org.neo4j.graphdb.Direction')->OUTGOING);
$depthSum = 0;
$nodes = $traverser->iterator();
while (java_values($nodes->hasNext())) {
$node = $nodes->next();
$depthSum += intval(java_values($node->getProperty("level")));
}
$tx->finish();
$tx->success();
echo "\ndepthSum = {$depthSum}";
self::printTime("done traversing");
}
self::$neo->shutdown();
echo "\nneo has been shut down";
echo "</pre>";
}
示例6: appendBookmarkedText
/**
* Copies content of the bookmark and adds it to the end of the specified node.
* The destination node can be in a different document.
*
* @param importer Maintains the import context.
* @param srcBookmark The input bookmark.
* @param dstNode Must be a node that can contain paragraphs (such as a Story).
*/
private static function appendBookmarkedText($importer, $srcBookmark, $dstNode)
{
$startPara = $srcBookmark->getBookmarkStart()->getParentNode();
// This is the paragraph that contains the end of the bookmark.
$endPara = $srcBookmark->getBookmarkEnd()->getParentNode();
if (java_values($startPara) == null || java_values($endPara) == null) {
throw new Exception("Parent of the bookmark start or end is not a paragraph, cannot handle this scenario yet.");
}
// Limit ourselves to a reasonably simple scenario.
$spara = java_values($startPara->getParentNode());
$epara = java_values($endPara->getParentNode());
if (trim($spara) != trim($epara)) {
throw new Exception("Start and end paragraphs have different parents, cannot handle this scenario yet.");
}
// We want to copy all paragraphs from the start paragraph up to (and including) the end paragraph,
// therefore the node at which we stop is one after the end paragraph.
$endNode = $endPara->getNextSibling();
// This is the loop to go through all paragraph-level nodes in the bookmark.
$curNode = $startPara;
$cNode = java_values($curNode);
$eNode = java_values($endNode);
//echo $cNode . "<BR>1" . $eNode; exit;
while (trim($cNode) != trim($eNode)) {
// This creates a copy of the current node and imports it (makes it valid) in the context
// of the destination document. Importing means adjusting styles and list identifiers correctly.
$newNode = $importer->importNode(java_values($curNode), true);
$curNode = $curNode->getNextSibling();
$cNode = java_values($curNode);
$dstNode->appendChild(java_values($newNode));
}
}
示例7: getCell
public function getCell($pos)
{
$cell = java_values($this->row->getCell($pos));
if (is_object($cell)) {
return $cell;
} else {
return null;
}
}
示例8: create_index_dir
/** create a temporary directory for the lucene index files. Make sure
* to create the tmpdir from Java so that the directory has
* javabridge_tmp_t Security Enhanced Linux permission. Note that PHP
* does not have access to tempfiles with java_bridge_tmp_t: PHP
* inherits the rights from the HTTPD, usually httpd_tmp_t.
*/
function create_index_dir()
{
global $tmp_file, $tmp_dir;
$javaTmpdir = java("java.lang.System")->getProperty("java.io.tmpdir");
$tmpdir = java_values($javaTmpdir);
$tmp_file = tempnam($tmpdir, "idx");
$tmp_dir = new java("java.io.File", "{$tmp_file}.d");
$tmp_dir->mkdir();
return java_values($tmp_dir->toString());
}
示例9: _send_response
function _send_response($bridge)
{
$page_data = $bridge->getResponseData();
$page_data = java_values($page_data);
// @ apache_setenv('no-gzip', 1);
// @ ini_set('zlib.output_compression', 0);
header("Content-type: " . $this->props->getProperty("content"));
header("Content-Length: " . strlen($page_data));
echo $page_data;
}
示例10: run
public static function run($dataDir = null)
{
$pres = new Presentation();
# Get the first slide
$sld = $pres->getSlides()->get_Item(0);
# Define columns with widths and rows with heights
$dbl_cols = [50, 50, 50];
$dbl_rows = [50, 30, 30, 30];
# Add table shape to slide
$tbl = $sld->getShapes()->addTable(100, 50, $dbl_cols, $dbl_rows);
$fill_type = new FillType();
$color = new Color();
# Set border format for each cell
$row = 0;
while ($row < java_values($tbl->getRows()->size())) {
$cell = 0;
while ($cell < $tbl->getRows()->get_Item($row)->size()) {
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderTop()->getFillFormat()->setFillType($fill_type->Solid);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderTop()->getFillFormat()->getSolidFillColor()->setColor($color->RED);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderTop()->setWidth(5);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderBottom()->getFillFormat()->setFillType($fill_type->Solid);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderBottom()->getFillFormat()->getSolidFillColor()->setColor($color->RED);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderBottom()->setWidth(5);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderLeft()->getFillFormat()->setFillType($fill_type->Solid);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderLeft()->getFillFormat()->getSolidFillColor()->setColor($color->RED);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderLeft()->setWidth(5);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderRight()->getFillFormat()->setFillType($fill_type->Solid);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderRight()->getFillFormat()->getSolidFillColor()->setColor($color->RED);
$tbl->getRows()->get_Item($row)->get_Item($cell)->getBorderRight()->setWidth(5);
$cell += 1;
}
$row += 1;
}
$tbl->getColumns()->get_Item(0)->get_Item(0)->getTextFrame()->setText("00");
$tbl->getColumns()->get_Item(0)->get_Item(1)->getTextFrame()->setText("01");
$tbl->getColumns()->get_Item(0)->get_Item(2)->getTextFrame()->setText("02");
$tbl->getColumns()->get_Item(0)->get_Item(3)->getTextFrame()->setText("03");
$tbl->getColumns()->get_Item(1)->get_Item(0)->getTextFrame()->setText("10");
$tbl->getColumns()->get_Item(2)->get_Item(0)->getTextFrame()->setText("20");
$tbl->getColumns()->get_Item(1)->get_Item(1)->getTextFrame()->setText("11");
$tbl->getColumns()->get_Item(2)->get_Item(1)->getTextFrame()->setText("21");
# AddClone adds a row in the end of the table
$tbl->getRows()->addClone($tbl->getRows()->get_Item(0), false);
# AddClone adds a column in the end of the table
$tbl->getColumns()->addClone($tbl->getColumns()->get_Item(0), false);
# InsertClone adds a row at specific position in a table
$tbl->getRows()->insertClone(2, $tbl->getRows()->get_Item(0), false);
# InsertClone adds a row at specific position in a table
$tbl->getColumns()->insertClone(2, $tbl->getColumns()->get_Item(0), false);
# Write the presentation as a PPTX file
$save_format = new SaveFormat();
$pres->save($dataDir . "CloneRowColumn.pptx", $save_format->Pptx);
print "Cloned Row & Column from table, please check the output file.";
PHP_EOL;
}
示例11: insertWatermarkIntoHeader
private function insertWatermarkIntoHeader($watermarkPara, $sect, $headerType)
{
$header = $sect->getHeadersFooters()->getByHeaderFooterType($headerType);
if (java_values($header) == null) {
// There is no header of the specified type in the current section, create it.
$header = new Java("com.aspose.words.HeaderFooter", $sect->getDocument(), $headerType);
$sect->getHeadersFooters()->add($header);
}
// Insert a clone of the watermark into the header.
$header->appendChild($watermarkPara->deepClone(true));
}
示例12: AppendDocs
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");
}
示例13: testCleanupDb
/**
* Tests whether the database is really empty after the _cleanupDb method.
*/
public function testCleanupDb()
{
$tx = $this->_neoGateway->factoryTransaction();
$nodes = $this->_neoGateway->getGraphDb()->getAllNodes()->iterator();
$nodesCount = 0;
while (java_values($nodes->hasNext())) {
$nodesCount++;
$nodes->next();
}
$tx->success();
$tx->finish();
$this->assertEquals($nodesCount, 1, 'Database is not empty or reference node had been removed.');
}
示例14: run
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();
}
示例15: find_shape
public static function find_shape($slide, $alttext)
{
#Iterating through all shapes inside the slide
$i = 0;
$slide_size = java_values($slide->getShapes()->size());
while ($i < $slide_size) {
# If the alternative text of the slide matches with the required one then return the shape
if ($slide->getShapes()->get_Item($i)->getAlternativeText() == $alttext) {
return $slide->getShapes()->get_Item($i);
}
$i++;
}
return nil;
}