Remove Java Loading image while loading Applet - java

I am using applet viewer for my Web Application.
Before loading the applet viewer, is it possible to remove the java loading image.
Please check the attachment.
Thanks -
Haan

See the image parameter in Special Attributes of Applets. To 'remove' the image you might simply replace it with a 1x1 transparent GIF, but a more meaningful loading image would be best.

Related

PDFBox - show icon for embedded files in pdf

I developed a Java PDF viewer using Apache PDFBox. The problem is, when rendering a page of a PDF, if the page has file attachments, there is no icon shown in PDFBox rendering, like there is a paper clip icon, when such a file is opened in Adobe PDF reader.
Is it possible to automatically have such icons in the rendering using PDFBox? I think I saw such a code some time ago, like a single line that switches this behavior on and off but I can't find it. Thanks.
This was fixed in PDFBOX-5394 and will be in the version 2.0.26. However only one single symbol will be shown at this time: a paperclip in fixed size.

Blurring JPG image using Java

I have an .jpg image that is generated by an application. What I want to do with it is, using java, blur out a box on the .jpg to a point where any text or content would not be able to be read, but doesn't aesthetically ruin the picture.
How would I go about doing this?
Edit:
I guess I'm needing more direction than just a simple how to do this. I don't have any background in image processing. What kind of java libraries or tools should I be looking at using?

Display SVG image with Foundation Image component

I am trying to use the Image component in CQ5.6 to include an SVG image on a page. I can get the component to use the SVG by dragging the image from the content finder to the component, but this also causes an error in the log:
Caused by: javax.imageio.IIOException: No decoder available to load the image
at com.day.image.Layer.<init>(Layer.java:786)
at com.day.image.Layer.<init>(Layer.java:588)
at com.day.image.Layer.<init>(Layer.java:511)
at com.day.cq.commons.ImageHelper.createLayer(ImageHelper.java:173)
at com.day.cq.commons.ImageResource.getLayer(ImageResource.java:569)
at libs.foundation.components.parbase.img_GET.writeLayer(img_GET.java:72)
at com.day.cq.wcm.commons.AbstractImageServlet.doGet(AbstractImageServlet.java:80)
at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:268)
at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:344)
at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:375)
at org.apache.sling.scripting.java.impl.ServletWrapper.service(ServletWrapper.java:126)
at org.apache.sling.scripting.java.impl.JavaScriptEngineFactory.callServlet(JavaScriptEngineFactory.java:211)
... 88 more
I've made several attempts to add support for SVGs by including SVG implementations of the javax.imageio, but have yet to succeed. The closest that I have come to success was using Batik, in which case CQ5 seemed to get stuck in an infinite loop at Layer.java:769-781.
Has anybody managed to make the OOTB Image component work with SVG images?
I ran into the same problem. I tried to download the file manually from CRX and opening that in my default image viewer. Unfortunately, my default image viewer also gave the same error.
For me the problem was with uploading part of that image. My InputStream passed in JCRUtil.put skipped some bytes to write because I used TikaInputStream before writting for validating the mediaType of the uploaded file.

Custom PDF creation - Large images

Looking for a Java based PDF creation library. We're currently using Apache Velocity with HTML to render PDFs on the fly.
We'd like to be able to find a way to render large images (sometimes as big as 3000 x 1700) in a creative manner within the PDF container. For instance, a scrollable image pane within a PDF. This might not be possible within a PDF, I might be wrong.
Open source would ideal.
For a good PDF library you should take a look at iText: http://itextpdf.com/
I have used images of around 5000x4000 with iText without any problems.
I don't know if it is possible to create a working scrollpane inside a PDF, unless of course you were doing it through a custom PDF creator/viewer.
iText is open source but make sure to check out the AGPL license before you use it commecrially: http://itextpdf.com/terms-of-use/agpl.php
For just creating PDF files from images iText is a little overdimensioned. Give xsPDF a chance, it has no limits for images sizes and seems to be appropriate for your problem.
Just a FYI for anyone that may run into this in the future:
I used a library called PDFBox (http://pdfbox.apache.org/) to open a pre-existing PDF and modify the PDF with a custom sized PDFRectangle with the dimensions of the image. Then inserted the image and rectangle into that new page and got the desired results.
I didn't realize you could have multiple page sizes in a single PDF.

which Java / Groovy library to overlay text on an image

I am working on a web application (using Grails) which will generate a gift certificate. I'm thinking of a workflow like this:
The user will pick a template which will be stored as an image.
Then the text (name, date, amount etc) will be overlaid on the image to make the final certificate. There is a set of co-ordinates associated with each template which describes where to put each bit of text.
There is a kind of 'live preview' in the browser which shows the user what the final certificate will look like.
When the user is happy with the results, they download the certificate as a PDF and print it.
Can anyone recommend a library for Java (or Groovy) that will make it easy to do this? I'm not particularly worried about speed, as I suspect that the webapp will only be used by a few people at a time.
UPDATE: in the end I used the iText PDF library to overlay text on a PDF template using PDFStamper.
You can do this with the standard Java 2D graphics libraries - create a BufferedImage from the image, get its Graphics and use drawString() to put the text on top. Of course, the text would then be part of the bitmap in the resulting PDF, and not use the full printing resolution.
In addition to the answers above, I have come across the groovy library GraphicsBuilder and the Grails plugin j2D which are also potiential solutions.
You might consider using Batik to do this as SVG. Your image would be an <img> tag and your text would be one or more <text> tags. There's a converter (called FOP, I believe) which will get you PDF output.

Categories

Resources