Printing a ticket in xpages - printing

In a xpages application I need to mount a label with a certain layout, analogous to the layout of a ticket. Searching, I have verified that the most used practice is to use openoffice to design the odt model and in java to use bilbiotec to JOD Reports. Do you advise to follow this line yourself, or do you have any suggestions?

I would concur with Marcus. The way forward is PDF output. There are a couple of ways to do this, depending on your constraints.
When user must design every aspect of the ticket using openoffice is a suitable approach, however you need a headless openoffice install for the rendering
If everything can be code, then PDFBox is a good way to go. Wrap your code into a managed bean
The middle path would be XSL:FO and Apache FOP. It allows alteration of the layout by providing a different style sheet. I wrote an article series outlining that approach.
Let us know what works for you!

There is also the POI4XPages plugin. You could design your form with Word and then use placeholders to populate the document and output as a pdf.
See https://poi4xpages.openntf.org/main.nsf/project.xsp?r=project/POI%204%20XPages/releases/E80C4FC9FB07E1E4852580E3006E02C7
Download the latest version (1.4) at http://p2.openntf.org/repository.nsf/home.xsp/poi4xpages/snapshots
Howard

I was able to solve my problem, because I discovered that here in the company there is the abcpdf software. Through a web service that uses the APis of this software, I pass the html code of the ticket and the web service returns the pdf document in an array of bytes. I created a managed javabean to consume the web service and display the pdf in the browser.
Thanks to all who have contributed in some way with suggestions.

Related

Custom Report Printing in Oracle Apex

What is the best way to create a Custom Report Template to print in Oracle Apex ? I saw some posts that've already been answered, but since they were Apex 5.1, I was wondering if these were still up to date, or if there are easier way no (I am using Apex v21.1). Also, the "Printing" attribute in the Reports does not give me the possiblities to do these specific things :
I would like the users to print an Interactive Report, which will display the logo of the company, the export date, and the data obviously. Is it possible to set custom margin so the list take more space on the page, and to set a custom size for the column, in case I have a column with a long text in it ?
Thanks in advance,
Thomas
Welcome to one of the weakest points of Oracle APEX, printing.
Honestly, the best option is Apex Office Print(AOP), but they are a paid plugin.
They enable lots of different printing, quite easy to grasp, and I am quite satisfied with them.
Other options I have seen are:
Make an excel sheet from within the database and you can generate that dynamically(you can also expand fields, colour them, probably can also put an image in there but I havent tried that).
I once decided to torture myself and I tried printing through HTML, as in I created an HTML document with the data I wanted(I made an invoice), but that has many problems, chief among them being page breaks.
Another option that was recommended to me, but that I have not yet tried was setting up an Apache FOP, having the Oracle database generate an XML, send it there and get back a nice looking pdf(http://www.apex-reports.com/videos.html).
I hope you get something working, and if you try this Apache FOP approach please let me know how it goes.

How iOS Google Now can show different card template

I wanted to know the technology decision behind the iOS Google app.
As we can see, in the app's Google Now feature it renders many different card templates for different scenarios, and those templates seems to be very flexible based on server inputs.
I was wondering if this is implemented all based on HTML5? or they just have many templates built in and render them locally? I'd vote for the HTML5 route but not sure if this still involved some native code to make it more responsive?
Thanks!
As we (well, most of the community) are not Google employees we can't tell you what they really did, but I'd say that it is possible to do this dynamically in the app.
We did develop something similar that responds to definitions sent by the server and transforms them to custom designed forms following basic rules.
Google reuses the design of those cards for different plattforms, the easiest solution should be showing some WebView and using HTML5.
I agree with Kevin, as this answer is entirely based on personal opinion, too.
The way I would go is to create a card class which will load some JSON data and format it with HTML and CSS. Looking at each card it would be hell to format things that way natively. I mean, attributed strings is not the way to go. Too much logic for deciding which card get a bigger text or a picture.
Additionally, the top header is most likely "localized" as well, so you get the location and load a localized image. But that is Google by nature.

Pdf Parsing Challenge

I have the following problem: I have a lot of papers in pdf format and I have to extract information from the first page of each one and then save it into a database
I just need to extract, the title, the abstract, keywords, authors list, universities list, emails. I want to do a script to get a string for each one of that fields, for each paper.
How can I do that? Does anyone already did that? What languages and tools do you recommend me?
and Does exist a paper repository that already do that database feeding?
Considering the pdfs could be with different encodings, I have to deal with this problem too. Any help with this would be great.
An example of a paper its here
Greetings!
http://pdfbox.apache.org/
You have to check about the security of the pdf, that it's really text and not an image. Check the command line application of pdfbox if it works extracting the text, then you can use the jar and use http://pdfbox.apache.org/apidocs/org/apache/pdfbox/examples/util/ExtractTextByArea.html
Hope it helps....
By the way it's java...
edit.
I have not used this as a jar library http://www.qoppa.com/pdftext/, but I used the example application and it works, but I decided to go with pdfbox...
You need a API to read your pdf.
Seems fine (I never try it though)
You can probably find others with this link :-)

Graphs and ASP.Net MVC

I have a graph which I would like to represent using an image on a website. The problem is generating this image dynamically based on the current state of the graph.
I'm using ASP.Net MVC 3 with C#.
I've been thinking about generating the image on the harddisk using some tool(Graphviz etc.) and then passing the path of the file to the view.
Security isn't a real issue, as this is just internal project based work for now, it is much more important that its easy to implement.
I've been trying quickgraph, and eventually i've had it generating DOT files (apperently it ignores my attempts to make PNG's) but the code fails because the program don't have access to where the files are generated. I suppose this is easy to fix, though.
Do you have any suggestions to how I could do this (If i should do something completely different or how i can get the DOT files rendered as PNG)?
Best regards,
Daniel
Just wanted to note that I solved this using the Google Image Chart, they have experimental Graphviz support: http://code.google.com/apis/chart/image/docs/gallery/graphviz.html
Simply generate an URL and insert an external image on your page.
If the graph library allows you, write the result to a memory stream and place it in the Cache (System.Web.HttpRuntime.Cache) with a key.
Use that key to generate the img tag in the view and point to an action ('View'?) in a controller ('Image') like "/Image/View/392838".
Create this controller and view and serve the contents (make sure to include proper MIME type, content type etc.) from there.
In the cache specify a decent lifetime for the object, such as 15 seconds, sliding expiration.

What is the best way to print screens from an ASP.NET page .NET1.1/.NET2.0

I have seen examples of printing from a windows application but I have not been able to find a good example of any way of doing this.
I've used the print style sheet
here's and article http://alistapart.com/stories/goingtoprint/ that will go through the way to set that up. Rather than setting up a special page that would need to be maintained as well.
If you just need to print your web page from the client-side use window.print(). Sample could be found here: http://www.javascriptkit.com/howto/newtech2.shtml. I would suggest preparing a special version of your page first with no dynamic content and with a layout which would look nice on print.
If you need to send something to printer on the server-side that would be a little bit more complicated. Check out this MSDN article on how to do the basic printing.
The browser prints your pages. If you need to tweak the page so it looks better on the printer, use CSS #media selectors.
Restating what others have said, you just need to call window.print() in javascript. That and build a separate css for print.

Resources