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!
Related
I recently found this guy's website, claiming he had found a way to set XML syntax coloration in a TextMergeViewer, a thing that is not "naturally possible" in Eclipse.
Here is the URL of his website : https://vzurczak.wordpress.com/2010/09/25/merge-compare-dialogs-and-xml-syntax-highlighting/
However, the way he dealt with the issue seems to be not applicable right now (in 2016, and I am running Eclipse 4.4.0). The two major problems I found are the following ones :
StructuredTextViewer cannot be resolved as a type (I see many forums telling that we cannot/could not access it)
It looks impossible to cast a StructuredTextViewerConfigurationXML to a SourceViewerConfiguration.
I am not pretending that he is a liar, but I guess that I missed something, or Eclipse performed some internal changes affecting his code, written in 2010.
If someone knows how to solve these issues, his help would be welcomed.
Thanks for reading.
StructuredTextEditor and related classes are part of the Eclipse Web Tools. In particular the 'Eclipse XML Editors and Tools' feature.
Some downloads of Eclipse include this, other don't. If you don't have it you can install it using 'Install New Software...'. Choose you main Eclipse site and look for 'Eclipse XML Editors and Tools' in the 'Web, XML, Java EE and OSGi Enterprise Development' section.
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 need to run code samples that are on this page:
https://cloud.google.com/appengine/docs/java/datastore/queries
I've been able to locate jars for all but the following:
com.google.appengine.api.datastore.Query.Filter;
com.google.appengine.api.datastore.Query.CompositeFilter;
com.google.appengine.api.datastore.Query.CompositeFilterOperator;
Can anyone point me to where they are located?
I'm also a bit concerned that because I'm getting jar files individually
that I might run into some compatibility issues. Is there one
location that has jars for all the samples on the page I mentioned above?
Thx,
Steve
You need to download the GAE SDK and include it on you project. All those classes are included in there.
GAE is a pretty complex PAAS product. You'll need to setup the whole platform in order to use it, you cant just use some bits of it on its own.
I'm trying to read pdf files in my android application. I don't want to use the default pdf reader and simply open a new intent because I need my own GUI, and want to use the first page as a cover. Therefore I need to make my own pdf reader. I did some research and came across muPDF and Android PDF Viewer Library.
I tried to follow tutorial to implement Android PDF Viewer Library, from the github description. But the problem is that it loads pdf file forever. Do I need to do something else than just the steps in the description?
I can't find any tutorials for the muPDF library, are there any? How to implement it?
If there is no useful answer for the previous two questions, are there any good pdf library out there with tutorials and good documentation?
Thank you, hopefully, I will be able to solve my problem
MuPDF is a very good library, you can definitely use it. If you need a complete example of Android app using MuPDF, I suggest you to take a look at this customizable magazine app on Github.
first of all, if you want to use MUPDF inside an existing android app project you can follow the guide you find at this link (all credits go to the author, I didn't write this).
I am trying as well to integrate a very simple PDF reading/printing solution inside my app and i am struggling to strip down/simplify the MuPdf application demo you get by following that guide. I already managed (somehow) to remove annotation and file-picking features, but i would really need some help as well to get all the job done. There's really a lot of stuff and absolutely no documentation about this. I am simply trying to read the code and figure out what is needed and what is not, removing features one by one and being driven by the errors you get in catlog.
Also, as we both (if I understood correctly your needs) need just the PDF rendering features, would be great if someone points out how to (if possible) disable some of the unnecessary features built in the MuPDF library when building it from source (as DjVu support, just as an example).
Hope this helps, even if it is not a real answer to your question.
This is how I succeeded in building a MuPDF lib on windows with Cygwin, android-ndk
Download MuPDF 1.3 Source from https://code.google.com/p/mupdf/downloads/list
unzip to folder c:/mupdf-1.3-source
Install Cygwin:
Download and run Run setup-x86.exe from http://cygwin.com/install.html
when installing cygwin, make sure you selected make packages and C++ compilers
Make generate. open cygwin terminal, run
cd /cygdrive/
cd c/mupdf-1.3-source
make generate
Install android-ndk:
download android-ndk-r9d-windows-x86.zip and unzip it to
c:/android-ndk-r9d
Build mupdf lib: on windows cmd console:
preparation:
cd c:/mupdf-1.3-source/platform/android
copy local.properties.sample local.properties
edit local.properties, uncomment
#sdk.dir=C:\\Program Files (x86)\\Android\\android-sdk
and change to
sdk.dir=REAL andforid-sdk Folder
build:
while still on c:/mupdf-1.3-source/platform/android, run:
/android-ndk-r9d/ndk-build
Upon the completion of the build, a folder named libs will be created under
c:/mupdf-1.3-source/platform/android
Create android apk.
Open eclipse, create a new android project from existing code, browse to c:/mupdf-1.3-source/platform/android, now you can create a mupdf apk.
Starting with Android 5.0 you can also use Android's internal PDF renderer and for manipulating PDF you can always use iTextg - just some alternatives for the future.
This SO answer lists some steps on how to rip essential pieces from the MuPDF Java sample app to one's own.
Preferably, I'd like to have a "ready to use" Java library I could attach to as a dependency. Is JNI preventing this or is it simply that no-one's gotten up to doing one?
Well, jmupdf is there (mentioned in this duplicate) but that lists Windows and Linux (not specifically Android) as the tested platforms. It seems desktop and dead to me (no changes in 12 months). At least compared to the vibrance of MuPDF itself.
I'm at my wits end with this Java Bridge, after trying to force it to do what I want in C# I've abandoned the idea and started to stagger my way through Visual C++, however I'm running into constant problems which I'm slowly resolving. Except this one!
I'm missing an include file called AccessBridgeDebug.h. << TL:DR read here.
I can't even compile ANYTHING that uses the includes for AccessBridge because they all reference the debug file, and it just flat out does not come with the package I downloaded, or the one prior to it on the website. Google yields 0 results for the search term "AccessBridgeDebug.h" which has caused me to realise I rely on google far too much.
Please, someone, help.
For those who have the same problem, the solution was fairly simple. The Java Access Bridge 2.0.2 only contains updated files, not the entire package. Furthermore, there is no readily available download link to the 2.0.2 full installer.
To fix it, go here: https://www.oracle.com/java/technologies/java-archive-downloads-java-client-downloads.html#accessbridge-2.0.1-oth-JPR (Located accessbridge-2_0_1-manual_install\src\bridge\src\AccessBridgeDebug.h)
And download the 2.0.1 full source. All the missing header/c++ files can be found in here.