Set Watermark on Document Using CMIS After view or download - java

I have Created Custom web Application using Java Servlets, and Connected to Alfresco Repository using CMIS.
I also have created one simple workflow using activity.
Now My requirement is, In workflow after view or download document i want to dynamically set the watermark on only downloaded copy. but not on original document which is in the repository.
How can i achieve this using CMIS.
Please provide sample code if you have.
Thanks in Advance...

Once you have the document downloaded, you are dealing with a straight Java File object at that point. CMIS is out-of-the-picture. You can use any library that knows how to work with PDFs to add a watermark. One example is iText.

Related

How to generate dynamic Images using Neo4j api in Java

I worked on a scenario to genarate images using graphic2d in java. Now I have to work on the same scenario using Neo4j api. Can anybody help me out with this or provide me where I can find the relevant content. Thank you
The Graph Visualization page shows several ways to generate a visualization.
For example, the neo4j browser UI allows you to download a PNG of the results of a Cypher query.

Trying to convert Rich Text to HTML with embedded images and file attachments

I've been reading about some xPages functionality about wrapping a document with DominoDocument.wrap(...) that is supposed to do this for you. However, I am in a stand along Java program.
Is it possible to get the xPages Jar Files to import into my application somehow? I do have the basic Notes Jars working.
it is unlikely you will get this working using the DominoDocument class. when you wrap the Document, it creates a 'DominoRichTextItem', during this process it extracts the attachments to the local filesystem so that the web server can easily serve the content during the user's browsing/editing session.
this attachment extraction process relies on the user's session information, as well as the xpages applications 'persistence service'.
you are better of trying to emulate this idea by using the standard notes API to extract the text/html mime part, and the extracting attachments/inline image mime parts for whatever your purpose

Extracting contents from a webpage and comparing using Java

I am developing a Java project in which i have a sub-module where i need to extract contents [text, image, color] from a webpage and compare it with another webpage. I am planning to use WinHTTrack software for downloading the webpage locally, but the problem is it doesn't save it as HTML. How can i download a webpage with HTML extension using softwares such as WinHTTrack [or just saving the webpage through ctrl+s is enogh.?]. Also i am planning to use HTML Parsers to extract the 3 content types[text, image, color],after downloading the webpage locally. So which parser to go with.?
WEll I use Httrack and it fetches html files as well. You are probably taking winhttrack project file as the only output file, but if you check inside the project directory there are html files (together with images, etc). I would suggest using - http://htmlparser.sourceforge.net/. It is a java library and since your project is a Java project it should be fairly easy to use it. You can also save the whole website locally using org.htmlparser.parserapplications.SiteCapturer (and specify whether resources such as images should be captured as well). Hope it helps.

Embed XML file into PDF

I need to embed an XML file (or simple text file) into a PDF generated via Java and Adobe LiveCycle SOAP call.
I can't use iText or another library but only HTML code submitted to LiveCycle for transformation.
How can I do?
Thank you!
If you have access to the LiveCycle server you can set up a simple process that makes use of the XSLT service bundled in Foundation (available on every LC installation) to transform the HTML to something that your PDF will consume. I can give advice but need more details on your environment and LC modules installed in your server.

GWT document format converter

I am searching on ways to make a small app using GWT for converting documents
from one format to other.
Mainly these formats .doc , .pdf , .odt , .rtf.. and maybe a couple
more.
Has anyone tried this before??
I came across the library JODConverter but it needs open office to be
already installed and i don't really know how many people have used it
with gwt in past.
Please give me some starting pointers, or if anyone has experience
with this kind of app, do share.
Thanks and regards,
Rohit
I was looking into implementing something like this a few month ago.
Since GWT compiles your code to JavaScript there is no way for you to do that on the client side, JavaScript can't access the file system.
So you would need to upload the file to the server first and do the conversion on the server side and send the converted file back.
I have never heard of JODConverter before, the the library I wanted to use was Apache POI . Unfortunately I can't tell you anything about it, because I haven't tried it yet.
It sounds like JOD Converter is precisely what you need since you're looking at multi format conversions from Java. You would install OpenOffice on your server and link it up with JOD Converter. When a document is uploaded, your application would call JOD Converter to perform the conversion and stream the converted document back to the caller. Alternatively you can put the file somewhere, and send a link (URL) back to the caller so they can fetch the document. You can also look at JOD Reports or Docmosis if you need to manipulate the documents.
GWT is mostly a client side toolkit. Are you trying to make a tool that does all the conversion on the client side, with no help from the server? In that case, you should be looking for JavaScript libraries that can read/convert all those formats. If you are planning to have the user upload their files to the server, then you can use whatever technology you want on the server, and just use GWT for the UI.

Categories

Resources