How to create RtfWriter2 document using iText PDF OutputStream? - pdf-generation

I am using the free version of iText (v2.1.7 in particular. Can't use AGPL version due to tight project budget) to create PDF and RTF docs.
I have an external interface (with no access to its source code) which creates a PDF and returns a OutputStream object. My requirement is to create a RtfWriter2 document using this OutputStream object. Below is the signature of that external interface method.
public OutputStream getPDFOutputStream();
Let me know if what I am trying to achieve is technically possible using iText 2.1.7.

Related

How To Store Data On Icloud in xamarin form.ios

enter image description hereThis Below my data I want to store on IClouds IOS, How Can I do that ,is it possible to store on iClouds ,please give me a code for that
enter image description here
This Below my data I want to store on IClouds IOS, How Can I do that ,is it possible to store on iClouds ,please give me a code for that
To save the "MyFun item" data, it is recommended to serialize the data and save it to a json file or an xml file.
For JSON serialization, you can install the Nuget package Newtonsoft.Json. For more info, you can refer to this document.
Or XML serialization, you can create an instance of XmlSerializer Class to serializes and deserializes objects into and from XML document.
Here are some related SO threads you can refer to.
How to write a JSON file in C#?
Serialize an object to XML
If you have got the serialized data, as mentioned in the comment, you can download official demo Xamarin.iOS - Introduction to iCloud, then pass it to MonkeyDocument.DocumentString.

Download file and serve it (Spring WebClient -> Liferay Porlet.serveResource)

I want to implement a Liferay Portlet that downloads a ~1GB file from a separate server, and serves it to the website visitor who clicked the link.
The file must be streamed in a memory-efficient way (so no loading everything into memory), and the user should see the download progress shortly after clicking (so no storing everything onto the local disk).
I must use WebClient because it seems to be the standard for making web requests within Liferay 7 (RestTemplate will be deprecated).
I started writing something like this, inspired by an example from the javadoc:
Mono<DataBuffer> bodyMono = client.get()
.uri("https://theotherserver.com/file94875.pdf")
.retrieve()
.bodyToMono(DataBuffer.class);
... which I would feed into the portlet's MVCResourceCommand.serveResource() via PortletResponseUtil.sendFile, which expects a java.io.InputStream.
Unfortunately WebClient gives me a Mono<DataBuffer> (or Flux<DataBuffer>), and another answer claims that reconstructing the InputStream defeats the purpose of using WebClient in the first place.
What would be the most efficient and WebClient-savvy way to implement this?
In case of Liferay, the documentation states, that you can use ....getPortletOutputStream() to retrieve an OutputStream.
After setting contentlengh (so browser knows how much to expect), you can use this: Convert writes to OutputStream into a Flux<DataBuffer> usable by ServerResponse
To write your data to the OutputStream

Vizrt API JSON Data integration with Graphics

I want to integrate JSON response from API on VIZRT software. Can anyone help me so as how to read the JSON response and display on the graphics or transition...
Thank you on advance.
The best and easiest way would be to use the DataPool plugins already provided in most Vizrt installations. These plugins don't require licensing and are supported in most versions of the software. There is a plugin titled DataReader which allows you to specify a file or web address to pull Excel, SQL, XML, or JSON information from and it can do this on a regular frequency (every 10 seconds, etc).
You can get a lot of info about these plugins on the documentation site.
Also, when installing make sure to do a Complete installation instead of Typical. That will make sure that all the DataPool plugins are installed.
Firstly, I would suggest for you to read the necessary sections Vizrt Documentation (It will point you to where you can find example projects etc).
There are many different ways of getting Json Feed to Viz GFX, but it all comes down to your requirements.
If you would like to use Viz Trio you could talk to the Media Sequence Engine of default port 6100 preview and 6800 program.
Or you could also communicate directly to the Viz engine using external Application using preferably .Net?
private void SetValueToDocumentByXPath(XmlDocument doc, string xpath, string value)
{
var nav = doc.CreateNavigator();
var it = nav.Select(xpath, nameSpaceManager_);
if (it.MoveNext())
{
it.Current.SetValue(value);
}
}
SetValueToDocumentByXPath(elementDoc,"//vdf:payload/vdf:field[#name='01']/vdf:value", "My new headline");
The line Above Target Tabfield 01, Setting its value to My new headline.
XMlDocument can be fetch from the MSE.

Sample application using AlchemyAPI

I tried sample Java program to call each of below Alchemy API for a text file.
TextGetRankedNamedEntities
TextGetRankedConcepts
TextGetRankedKeywords
TextGetLanguage
TextGetCategory
TextGetTextSentiment
TextGetTargetedSentiment
TextGetRelations
TextGetCombined
TextGetTaxonomy
Individual results look good. But is there any sample Java application using these APIs? Showing how the XMLs given by AlchemyAPI will be used to deduce a meaningful business insight.
The Watson Developer Cloud Java SDK supports the AlchemyAPIs and it uses Objects instead of returning the XML so it's pretty easy to integrate with an existing Java application.
For example, the code belows uses the AlchemyVision API to recognize faces in an image.
AlchemyVision service = new AlchemyVision();
service.setApiKey("<api_key>");
File image = new File("obama.jpg");
ImageFaces faces = service.recognizeFaces(image, true);
System.out.println(faces);

How to read excel file tibco activities?

I have a requirement to read excel file using tibco palettes.Can any body please throw some lights regarding this. I am basically new to this tibco BW. Please tell me what steps should I follow?
I am assuming you are not referring to CSV files, for which you could use the File Read and Parse activities of BW.
If you want to parse or render a multi-worksheet workbook, you can try publicly available API's such as Apache's POI or commercial API's such as from Aspose to cut your own Java based solution. Then you can use the Java Code or general Java activities to embed and use that code.
And then there's another ready-to-use option available from us: an Excel Plugin for TIBCO BusinessWorks, if you wish to leverage all built-in features of BW (XPath mapping, etc) when parsing or rendering your Excel.
Edit 1:
As per your comment, you can also try the following steps, if you are looking for a more homegrown solution.
Based on one of the (public/commercial) libraries above you can write generic Java Code to parse each cell of each row of each sheet of the workbook. Output should be an XML string. Then create an XSD to match your output. It is at your discretion, which information of the cell you want to read from the workbook - you already are aware of the complexity of the API, I am sure.
Create a BW (sub)process that calls your code from a Java activity, use Parse XML to parse your XML string result into you XSD structure. Configure the End activity to use your XSD and map (copy) your Parse XML result into the End activity.
Then wrap this subprocess into a Custom Activity (General Activities Palette). Create a Custom Palette and now you can re-use what you did in many other BW projects. The path to the custom palettes can be found in TIBCO Designer - Edit- Preferences - General - User Directories
If you add Error Output schemas, you will also get typed error outputs from that custom activity.
HTH,
Hendrik

Resources