How to extracting only text from the .ppt using Apache Tika - apache-tika

public class Test {
public static void main(String[] args) throws Exception{
String data;
TikaConfig tikaConfig = TikaConfig.getDefaultConfig();
Metadata metadata = new Metadata();
ContentHandler handler;
try (InputStream stream = new BufferedInputStream(new FileInputStream(new File("E:\\AllTypes\\PPT\\Presentation1.pptx")))) {
Detector detector = tikaConfig.getDetector();
Parser parser = tikaConfig.getParser();
MediaType type = detector.detect(stream, metadata);
metadata.set(Metadata.CONTENT_TYPE, type.toString());
handler = new BodyContentHandler(-1);
parser.parse(stream, handler, metadata, new ParseContext());
data = handler.toString();
System.out.println(data);
}
}
}
I have only Hello world! in the input ppt So i want only Hello world!
Output: [Content_Types].xml
_rels/.rels
ppt/slides/_rels/slide1.xml.rels
ppt/_rels/presentation.xml.rels
ppt/presentation.xml
ppt/slides/slide1.xml
Hello world!
ppt/slideLayouts/_rels/slideLayout6.xml.rels
ppt/slideLayouts/_rels/slideLayout7.xml.rels
ppt/slideLayouts/_rels/slideLayout9.xml.rels
ppt/slideLayouts/_rels/slideLayout10.xml.rels
ppt/slideLayouts/_rels/slideLayout8.xml.rels
ppt/slideLayouts/_rels/slideLayout11.xml.rels
ppt/slideLayouts/_rels/slideLayout1.xml.rels
ppt/slideLayouts/_rels/slideLayout2.xml.rels
ppt/slideLayouts/_rels/slideLayout3.xml.rels
ppt/slideLayouts/_rels/slideLayout4.xml.rels
ppt/slideMasters/_rels/slideMaster1.xml.rels
ppt/slideLayouts/slideLayout11.xml
Click to edit Master title style Click to edit Master text styles Second level Third level Fourth level Fifth level 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout10.xml
Click to edit Master title style Click to edit Master text styles Second level Third level Fourth level Fifth level 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout3.xml
Click to edit Master title style Click to edit Master text styles 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout2.xml
Click to edit Master title style Click to edit Master text styles Second level Third level Fourth level Fifth level 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout1.xml
Click to edit Master title style Click to edit Master subtitle style 1/30/2018 ‹#›
ppt/slideMasters/slideMaster1.xml
Click to edit Master title style Click to edit Master text styles Second level Third level Fourth level Fifth level 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout4.xml
Click to edit Master title style Click to edit Master text styles Second level Third level Fourth level Fifth level Click to edit Master text styles Second level Third level Fourth level Fifth level 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout5.xml
Click to edit Master title style Click to edit Master text styles Click to edit Master text styles Second level Third level Fourth level Fifth level Click to edit Master text styles Click to edit Master text styles Second level Third level Fourth level Fifth level 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout6.xml
Click to edit Master title style 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout7.xml
1/30/2018 ‹#›
ppt/slideLayouts/slideLayout8.xml
Click to edit Master title style Click to edit Master text styles Second level Third level Fourth level Fifth level Click to edit Master text styles 1/30/2018 ‹#›
ppt/slideLayouts/slideLayout9.xml
Click to edit Master title style Click to edit Master text styles 1/30/2018 ‹#›
ppt/slideLayouts/_rels/slideLayout5.xml.rels
ppt/theme/theme1.xml
docProps/thumbnail.jpeg
ppt/presProps.xml
ppt/tableStyles.xml
ppt/viewProps.xml
docProps/core.xml
PowerPoint Presentation srinuk srinuk 1 2018-01-30T10:19:34Z 2018-01-30T10:22:05Z
docProps/app.xml
2 3 Microsoft Office PowerPoint Widescreen 1 1 0 0 0 false Fonts Used 3 Theme 1 Slide Titles 1 Arial Calibri Calibri Light Office Theme PowerPoint Presentation false false false 15.0000

You can try to use tika-app.jar.Just use a Tika extract text function.
Tika tika = new Tika();
File file = new File("path");
String str = tika.parseToString(file);
This code just parses text content from the file.

Related

How do I create a lightbox in AppDrag?

I would like to have a Youtube video play in lightbox format. Is there a way to achieve that using the AppDrag CMS editor?
First create a new page in your project.
Keep the page format as a landing page, removing thus the header/footer.
in the new page, click on the "+" button on the left then click on ELEMENTS > Medias and Drag a youtube element into the blank section and remove the placeholder text there.
Right click on the section containing the video, click on SECTION > Edit > Position and there check the "full height" checkbox.
Go back to your original page.
Open the button you would like to use to trigger the video, and select the Link tab.
Scroll to Website Page -> select the page you have created earlier.
Then a bit lower, still in the Link tab, select "Open in -> Modal".

Show div as per a pre selected dropdown when page loads

I want to show a division as per the selected value in drop down list when page loads. For example,
If I have a drop down containing 2 options and i have selected option 2 and it shows a div2 then when page reloads, it should again show the option2 selected and div2 shown instead of option1 and its div1.

How to create a tool tip with some content on top of the selected text

I am trying to create a fire fox plugin to display the word's meaning when selected. How to create a tool tip with some content on top of the selected text ?

How to realize the automatic jump to the specified page

i want to do a function,that is in page-based,i add a button,when i click the button,pop-up a Select box.In the selected box input the page number,but how can i realize that when i input the page number,the page jump to the specified page
edit:
I want to do a calendar,the label title bar in the top i have used button,now,it is that when i press the button,it will pop up a marquee,in there have month.now ,i want to press a month in the press box,then turn to the corresponding page.

Cannot detect Frontpage properly in Joomla 2.5 templates

I've seen in Joomla documentation the way to detect if you are in Frontpage while creating a template in Joomla 2.5. This is the code:
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'This is the front page';
}
?>
This works when you are at home page (or clicking on Home menu), but I have an slider in home page, and I link in the slider to an article which is not in any menu item in the application. When I load this article the code above returns as I were at frontpage. I guess that if I doesn't click on any menu item, $menu->getActive() doesn't change.
Any suggestion?
Thanks in advance.
You can do one thing to solve this problem. Create a hidden menu of all the article links which are linked in the sliders.By creating hidden menu the link will be initialized and $menu->getActive() will work for all the links..Hopefully it will works for you .
I wish to add to the present answer and provide some clarifications.
In order for the menu selection to be detected the page requires to be assigned to a menu item. If this is a hidden menu than the link to such a page called My Page would be:
/index.php/my-page - “my-page” is the menu title alias for this item
However, if one wants to show the correct hierarchy in the breadcrumbs for the same page, then the menu hierarchy would have to be replicated in the hidden menu.
For example if My Page is under My Articles main menu item, then in the hidden menu you should add “My Articles” item, of the type: Menu Item Alias, which is in the Systems submenu of the menu type field. The My Page item should be a sub-menu item of My Articles.
The “My Articles” menu item in the hidden menu must have a different menu alias than the same one in the main menu hence the new link to My Page would look like:
/index.php/my-articles2/my-page
To create a hidden menu, one simply creates another menu. It does not matter whether one creates a module for it or not, but if one does then one just should not assign any position to that module.

Resources