I am using Barteksc AndroidPdfViewer to load my applications PDFs.
The problem is that after I zoom in my loaded PDF, when it tries to render again, it just get blurry:
Has anyone been using this library or knows a solution for this particular problem? I have tried using .enableAntialiasing(true) but it does not solve the problem.
EDIT:
These are the configurations I am using for my PDF View:
pdf_view.fromFile(temp)
.enableSwipe(true)
.swipeHorizontal(true)
.enableDoubletap(true)
.enableAntialiasing(true)
.onPageChange(this)
.onLoad(this)
.onTap(this)
.pageFitPolicy(FitPolicy.BOTH)
.pageFling(true)
.pageSnap(true)
.autoSpacing(true)
.load()
As for the PDF, sorry but I can't provide one. The PDF is downloaded in the application and has some method not created by me do decrypt the file. I just use the decrypted PDF, but I have a hint that the problem is not from the PDF itself since my coworker has this working in is iOS version with the same type of PDF.
If you are using latest beta versions it have some bugs , try 2.8.2 stable version , i have used it in many applications i can tell from my experience that it its a problem of pdf or a particular phone
I think this section will help you : github.com/barteksc/AndroidPdfViewer/#double-tap-zooming
You can set max zoom suitable to your needs.
Related
I have a bunch of PDF files created by iText which i want to convert to images. I'm using JPedal to do so and it works in 99% of the cases but sometimes the images are incomplete. That means the content of forms or tables is missing or if the page contains only a picture (scan of a page) the resulting image is completely blank.
I have noticed that this only happens if the PDF file contains scanned pages. These are not exactly A4 like the rest of the document.
I tried to read the files with iText, create a new one in a temporary bytearray which contains only A4 pages and give this to JPedal. Also i set flattening to true. But nothing has changed.
Any ideas what causes this problem?
EDIT: I'm using jpedal-lgpl.jar in version 4.70. I searched for a more recent package and found version 4.92b23. With this one the content of forms gets converted correctly but the scanned pages are still blank with parts that look like what old TVs show when they have no signal.
I'd love to use the newest version but i can't find a download link. Did IDR Solutions stop publishing a lgpl version?
Did you use the flattening functionality of iText or of jPedal?
The "classic" jpedal LGPL version stopped since version 4.92b23. The first version not released under LGPL was 4.93 and later 5.0. The author removed it completely from sourceforge a while ago which contradicts the open source idea imho but that is another story...
However depending on the java version you are using there is a new LGPL JPedal. Instead of Swing/AWT it uses JavaFX but you can still transform your images like before. So if you can use Java 1.8 then you can use that LGPL version and see if that fixes your problem...
Update:
To fix the problems with your forms you can also flatten with jpedal: -Dorg.jpedal.flattenForm=true (or System.setProperty("org.jpedal.flattenForm","true"); )
One last possibility which comes to mind would be to fiddle around with the other jpedal options: https://www.idrsolutions.com/jpedal/support/jvm-flags/
Do you have the possibility to supply such an problematic PDF file for analysis?
We are paying customer of JPedal and we stumbled accross some threading issues some while ago. The problem got fixed quite quickly by IDR.
Try rendering in a synchronized block and see if the problem still persists.
I'm trying to create PDFs from xml data. I'm using Apache FOP 1.1 for Java in Windows.
The application runs perfectly in the Eclipse, but when I try to run it from the exported .jar images are not placed in the PDF. I've tryied running it at the cdm in order to see the log of the runtime. Here is the exception:
GRAVE: Image not available. URI: out/iberdrola.png. Reason: org.apache.xmlgraphics.
image.loader.ImageException: The file format is not supported. No ImagePreloader
found for out/iberdrola.png (No context info available) org.apache.xmlgraphics.
image.loader.ImageException: The file format is not supported.
No ImagePreloader found for out/iberdrola.png
at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:180)
I've to explain that even if it's an exception, the program runs until the end and the PDF is rendered but without the image.
I've tryied some different ways to solve the problem, but no success. Much of the information I've googled relates to servelts, but I'm not programming a servelt. By the way, here I give you two different solutions that have worked to some others. They are related but I spect the procedure is different. I don't know how to try them, could anyone explain me those better? Even if they are explained there must be any step I'm missing.
http://apache-fop.1065347.n5.nabble.com/FOP-1-0-images-fail-to-render-td7348.html
Apache FOP in a Java Applet - No ImagePreloader found for data
I'm also open to any other solution to this problem.
Thanks in advice!
Have a nice code!
I finally came out with the solution. I don't know exactly wich of the two steps I made was the one that solved everything, but here it is.
Firstly, I changed the libraries of the project. I realised that the fop_1.1.jar I was using wasn't the official one provided by Apache. So I went to the official site and I downloaded the binary version. I added to my buildpath the fop library and the rest of dependent libraries of the folder called 'lib'.
Then, I increased the compilation version of Java. I was using the 1.4 version and many of the libs used require 1.5 or above. So as I realised that most of the computers nowadays use 1.7 or above I set it to 1.7.
I can't tell you which of the two solutions made this miracle, but for further projects I will check before that I'm using the correct libraries and that I have to check the minimum compilation version.
Have a nice code!
When using <tr:chart> component from Trinidad lib there is problem using it in Explorer since it does not have built in support for SVG viewer.
Trinidad has hard coded url in case of error which open adobe page of SVG viewer.
The problem is that it link is not updated since there is no SVG installation in adobe.
We need to supply different link. how can we override this URL?
Is there any better solution ?
Adobe have decided to discontinue support for the SVG viewer on January 1, 2009.
Ever considered using Highcharts to generate graphs in your Trinidad project? We do and it works like a charm! It does not use SVG on older versions of Internet Explorer; see Highcharts compatibility documentation. Also, Highcharts has way more possibilities to generate graphs and add interactivity then <tr:chart>. Actually, <tr:chart> is kind of limited in its possibilities.
The downside is that you don't have a JSF component to work with. Creating a static graph will be easy, but you might want to write a few lines of code to pass your data to the Highcharts Javascript to get things a bit more interesting. Trinidad's ExtendedRenderKitService comes in handy there:
ExtendedRenderKitService service =
Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext, "alert('foo');");
I'm working on an existing Java web application (HTML/CSS/JS/JSP/Servlets and Java classes in this particular app) that currently uses an applet to print checks.
My boss recently came to me and informed me that there are errors coming back on user's machines when testing the check printing against the latest versions of Java.
He is wondering how we could set up the application to print checks off without using an applet.
In the past, I've used Crystal Reports to lay out forms and print them but that was in asp.net.
I know there are Java PDF libraries available but I'm not at all familiar with any of them and not sure that they could be used to format and print checks in a Java web application.
So, I'm ultimately wanting to know about what has worked for those who have implemented check or form printing using Java/JSP/Servlets.
2012-02-24 # 13:15EST edit
I mentioned "Java PDF libraries" above but have since found out that PDF cannot be used as end-users should not be able to save the check documents (unless PDF's can be made to not be saveable and just printable). All of the data is managed right on the database (Oracle in our case).
I've used iText to create PDF files before for things like this. PDF is your answer, since the whole point of the format is that it never really changes. Much better than an Applet.
http://itextpdf.com/
I ended up digging deeper into using iText and came across flying-saucer which makes it super-easy to render a PDF from XML or XHTML.
Check it out at http://code.google.com/p/flying-saucer/
I also found out how to partially hide the save functionality by rendering the PDF inside a hidden iframe: Create a "print-only" PDF with itext
I am trying to link some user docs to my Java Swing application. The user docs are pdf and I would like to be able to click on a button in my application which opens up some sort of pdf renderer to display my userdoc.pdf.
I do not want to use the runtime exec command
I have tried the following with not much success --
pdfRenderer -- this seems to not work for the current version of pdfs (seems to want older pdfs)
acrobat viewer -- I keep getting font errors (the document is displayed but everytime I go to a new page, I get an error)
JPedal pdfHelp - This sounds cool and if it will work, it would be the best for me. But for some reason, I am unable to open any file here. No pdf file that I have loads in the window (The pdfHelp panel comes up with a list of pdfs as promised, but when I right click one of them and say "OpenPDF", I just get a progress bar and the file does not load, I have tried a few files on this and checked file permissions)
JPedal SimpleViewer -- So far this one seems to be the most promising. I would like to remove some of the functionality of this viewer though and am not able to edit the xml to do this. When I edit the xml, then I seem to get xml parsing errors.
Has anybody done anything similar that worked? Help please
PS. I need this to work on Linux machines (IcePDF seems to works only for Windows). I would very much prefer something that is free!
Would Java's Desktop API meet your requirements? It does launch another process, but it's not through you calling Runtime.exec().
The Desktop API uses your host operating system's file associations to launch applications associated with specific file types.
Update: pdfHelp from IDR solutions (creators of JPedal) works now. The latest version (4.0) has fixed the bug and it reads my pdf files (and I am sure more of the latest pdf files). Just playing around with the product today and it is great! There are few minor bugs but I really appreciate how quickly Mark Stephens(?) responded to the first bug. Good work guys!
I chose pdfbox for a similar use case - it's not perfect with every PDF, but works pretty well and is under active development. From the PDDocument you can get a list of PDPage objects, which have a convertToImage() method that gives you a BufferedImage you can draw on screen. I switched to this from pdf-renderer because I felt it gave better results in general.
PdfHelp has moved to its own domain at http://www.pdfhelp.org and have been updated to fix your issues and add some other improvements...