I use iText to batch enable shared reviews in pdf files at the server level. Injecting the required javascript is accomplished using the PdfStamper's addJavascript() function. This does enable the shared review, however i cannot create archive versions properly because the document level javascript "Script Name" is not correct. iText sets the Script Name sequentially starting with 0000000000000000, then 0000000000000001, etc. I need to set the Script Name to "com.adobe.acrobat.SharedReview.Register" instead. Is there any reasonable way to accomplish this?
I had to check the iText source code myself, and to my surprise I discovered that we overlooked a method. There was supposed to be a method that allows you to choose the name, but there isn't.
You can work around this by adding the JavaScript straight to the writer:
stamper.getWriter().addJavaScript(
"com.adobe.acrobat.SharedReview.Register",
PdfAction.javaScript(js, stamper.getWriter(), !PdfEncodings.isPdfDocEncoding(js)));
where js is the JavaScript you want to add.
Granted, this isn't elegant. Let me know if this works, and I'll see if I can add the extra method in one of the next releases.
Related
I'm setting up a new web app and came to know that the company name is spelled incorrectly in all the web pages. So, I want to change it in all of them. I am using eclipse neon.
Is there any way to add or replace text from all the web pages in Eclipse ? or Will I have to change them manually one by one?
Tried using ctrl+shift+R but it's for the change of method or variable name in eclipse.
The eclipse IDE is mainly a programming tool, and as such it also supports:
searching for files using wildcards
replacing content using regular expressions within all finds matching your condition
Simply turn to Search"->"File" and enter your search text, a file pattern and then use replace!
And of course: the real answer is to step back and look into what you are doing! Such repeating information (that has to be always the same in many different places) should always come out of 1 source file, not out of 120 different files. That comment about "don't repeat yourself" is the real solution here!
I think, it is better to create a separate header page and separate footer page and include them in all web page. So next time if you make this type of mistake you should not think about the all page, you can just change in one page and see the change in all page.
Eclipse - Search - File..
in this example will be replace "conpany" in all jsp's with 'company'
I am looking to find out if any API exists that can complete a task I am considering. I want to create a tool that allows a user to upload a xml file. I want that XML file to be displayed visually in a GUI. Using an API (I assume) I then want to give the user the ability to click on any tag. Once the user clicks a tag I would like for a second method to run which takes that value and runs some other methods. (The other methods include some DB calls but are not important).
I'm rather in the dark here with no idea how to accomplish this. I know how to display a XML in a java swing GUI but I am not sure how to allow a user to click on those tags AND have the values captured.
Would a API be required to do this or are there already some ways within vanilla Java that could allow it? Please give me a name of an API if you know.
Thank you.
You should be able to do that with javax.swing.JTree and javax.swing.event.TreeSelectionListener.
https://docs.oracle.com/javase/7/docs/api/javax/swing/JTree.html
https://docs.oracle.com/javase/7/docs/api/javax/swing/event/TreeSelectionListener.html
I'm working on learning JSP and the Play framework, and I understand that it runs on Scala and renders views based on templates, but what if I just want to use plain HTML rather than scala templates?
The situation I'm in is that I'm designing the site to match a visual template, so I'm using Dreamweaver to build the html files. I really like Play framework though, so I'd like to continue using it. So, what are my options here?
I don't get. Play's views are not just nice html files, of course you can (or even should) use your favorite tools for design part, anyway you have to also learn how to include a dynamic parts in it.
Of course you can use DreamWeaver for that task as it has feature for editing source code. But I can ensure you from my own experience, that there are better tools for every-day work with Play's views than DW.
You can also use plain HTML in your /public folder however in this scenario you won't be able to make it dynamic, so it has no sense, as you can create the pages without any framework - just using static files created with DW.
In general words: you need to verify your needs, cause from your question I read: "I like Play framework, anyway I don't want to use it for its job..."
After-comments edit:
You don't have to make views dynamic. If you won't pass any arguments into the view and will put there pure HTML it will be 'relatively cheap' way for displaying static pages as well. Just you need to remeber to leave first line of the file empty. So you don't need to use File index = new File... instead just put your bare HTML code into ie: app/views/staticContact.scala.html and then use an action:
public static Result staticContact(){
return ok(views.html.staticContact.render());
}
On the quite other hand, last time I was wondering if it wasn't better to put HTML code of the static pages into the DB, in such case you could create an editing page, where you could change HTML without redeploying the application. All what you will need it was just fetching HTML from DB and displaying it in one generic view. For better performance you can use included Cache implementation.
GET / controllers.Assets.at(path="/public/html", file="index.html")
This is working for play 2.0.1 for /public/html/index.html file
I found that Liferay transfers my JSP code in a somehow "condensed" way -- putting most of the text into a few very long lines.
This makes it uncomfortable to debug javascript.
Is it possible to turn off this feature temporary?
For others looking at this post, if you simply want to do this on an adhoc basis you can add these params to the URL:
/web/guest/page?js_fast_load=0&css_fast_load=0&strip=0
Note this is for JS, CSS and HTML
HTML Minification is on regardless you're in developer mode or not since HTML stripping can itself produce problems you want to see in developer mode.
You can add strip=0 parameter to the URL to prevent the served HTML page being stripped.
In order to turn HTML-Stripping completely off change in your system.properties:
com.liferay.filters.strip.StripFilter=false
But as #BalusC said you should use a tool which does the formatting when debugging. So you're not bothered by the stripping.
There are two ways to do it. Copy the following in portal-ext.properties and restart the server
javascript.fast.load=false
or If you dont want to restart and its just for temporary purpose add js_fast_load parameter to url and set its value to false.
For example if you are in a page http://localhost:8080/web/guest/home in which your portlet or the javascript is present. Use this url instead http://localhost:8080/web/guest/home?js_fast_load=0
Liferay has a file named portal-developer.properties as template in WEB-INF/classes. You can either reference this or just copy/paste the content into your portal-ext.properties.
This has several options to minify html, js, css and others. You'll kill your loading time - i.e. you really only want these options at development time, but then it really helps.
By default all files are also combined into a single one (for js, another for css etc.) - with the development options you'll get a separate request for every file on every page request.
I just want to update package name for Liferay 6.2 from #Fabian Barney's answer:
com.liferay.portal.servlet.filters.strip.StripFilter=false
I stumbled upon the need to find out (inside Java code) which files are dynamically loaded by an SWF-file. Is there any possibility to get a list of paths of every object referenced inside?
I tried out some libraries without proper documentation and gave up. Although I ran out of Google Search Phrases... ;)
Maybe there is an external tool which can be accessed by Java via command line?
Ggreat thanks in advance
Maybe you can get to the information you need using the dump tool which is part of Apparat.
I use actionscript more than Java, so I also recommend having a look at AS3SWF which is a great library you could use to load and analyze the swf you need. Think of it as decompiling at runtime.
Either way, the SWF Format Specifications will come in handy.
I'm not sure there's something that does exactly what you want, but I imagine you could collect all the strings (DefineText tags), loop through them and run an URL RegEx against them.
I think even if you could analyze a SWF file, you can't be sure to get this information. I have Flex Project (finally a swf file) which dynamically loads some modules, but the names (URLs) of the available modules are requested from the server. So there is no chance to retrieve this information from the main swf file.