Word2Fo Java PlugIn - java

I'm using Word2Fo to generate XSL-FO code so that my Java application can generate a PDF instead of a Doc. This is all well and good, and I've gotten the raw XSL-FO code now, but there's over a thousand lines of FO instructions, and it would be a pain to go over every single line to format it for Java output in w.write.
Is there any plugin for Word2Fo that can do this automatically on conversion? Directing me to a Word2Fo Plugin library would be help in and of itself as well, since I can't seem to find one naturally existing anywhere.

Related

Java creating PDF file

I am currently working at a project which generates contracts. The idea is that I put the data in a form and save it in a simple database.
So long, this was my favorite place to search for good ideas and simple solutions.
Now I am facing another problem and I don't know how I can solve that. I want to create a PDF and replace some placeholders with some data from my form.
One idea was, that I use an existing Word template with some bookmarks and replace them with the data from my form. Maybe there is a way to do that, and I am just too stupid to find it.
Another idea was, that I am using XML. Therefore, I thought I was clever and just converted the Word template to an PDF, so I am able to convert that PDF to an XML. Attached, you find the XML file. But now I need the XSL file - is there an easy way to create the XSL file?
Or maybe there is another simple solution to solve my problem.
In these attachments you find the PDF file, the Word template and the XML:
Thank you a lot :)
Using a template is a good idea - it makes some changes much quicker to make and then deploy. The comments above are focused on conversion, but don't forget you need to merge your data in (population) first.
If you can use Adobe tools, you can have a PDF template and use the Adobe tools to populate. This saves a "conversion" stage.
You mentioned using Word for templates. This means you to run through two stages of processing:
population - docx is a zipped set of XML files - so you can process them with your own code or using a library.
conversion - you need pdf, so you have to convert the docx to pdf. You also have to watch out for fonts at this stage (ie make sure they are available on your host).
The population stage you could do yourself since you are familiar with XML. But it is definitely complicated. The conversion needs to use a tool that is ideal for it. There are a few mentioned in the comments already.
There are some free/os and commercial tools that can do both parts:
docx4j
JOD Reports
Libre Office (using the Java Uno API) (I blogged this once - Java Convert Word to PDF with UNO)
Docmosis (please note I work for Docmosis)
I suggest starting with the simple example you have attached and prove you can both populate and convert that. Then switch to a more complicated example to see if you can do the other things that might be required (eg repeating or conditions or other logic) during the population stage.

How to parse and edit MS Visio file in java code

I have checked multiple links and two options were shown for editing MS visio file in Java code.
Apache POI - HDGF and XDGF - Java API To Access Microsoft Visio Format Files
Aspose.diagram APIs
Has anyone done any coding in Java language using above option?
I am using eclipse IDE.
Also please suggest if there is third better way to edit MS visio file using java code.
If you are talking about libraries, these are the two basically. Apache POI AFAIK can't create diagrams, only read, if I am not mistaking - but please verify, maybe something changed since I last looked at that ten years ago.
So this basically leaves you with a single choice. Or you can always spend a few years and write it all yourself. Well, man does not simply walk into mordor create visio files with java.
Maybe you could consider using SVG instead, that can be generated and consumed by basically anything? Visio can also read and write SVG out of the box.

What are some libraries/ways of manipulating MSWord formats in Android?

I've been working on ways to load/edit and then create .docx files for the past week now. I just need to manipulate text within a template and later down the track add pictures. I've tried the following libraries and will explain where i got to for each.
Apache POI (library for android https://github.com/andruhon/android5xlsx)
I imported all the libraries necessary and was able to create an empty .docx then when i went to load a docx then write it again and recieved this error
Apache POI (library for android https://github.com/andruhon/android5xlsx)
org.apache.poi.xwpf.usermodel.XWPFFootnote.init(XWPFFootnote.java:64)
I know that it will lead me around a circle again and will result in someone saying (these classes can't be used in android). The link is only made for xlsx (an excel format). I've already tried.... "import org.apache.poi.usermodel.*;" This is because the classes used for the function are designed for not android and reference the JDK classes
Docx4j (android branch)
I was able to get write the load and save code but it hits this error as soon as it needs the JAXB.jar, which i had imported (its this one ae-jaxb-2.2.5 for android) but the problem is that it's still trying to read the javax folder in the java JDK.
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/bind/JAXBContext;
Please only respond to my errors if you've experienced my trauma and are living proof that this is possible. Otherwise please do recommend some other libraries or ways around me getting a Document manipulation function happening.
I'm using java 1.7_79 SDK and that latest android studio.
What are some libraries I can use to manipluate MSWord formats in Android?
Else, how, other than editting straight xml copies of the template can I program a way to alter text in a document from android?

Create a readable report (PDF) from XML output in Java

I'm trying to make a tool that's able to import XML output files from a certain tool and 'convert' them into nice a nice PDF report that sums things up in understandable language for normal people.
Output files always contain specific data, but I just want my appliciation to automatically create a report that's not hard to read for someone who's not very familiar with technology.
I know it's impossible to do completely automated, so I guess I'll have to use some kind of pre-defined templates or something, but I'm not sure what the best solution is.
Importing and reading the XML files isn't hard, but how do I convert them to a readable PDF document?
Apache FOP may help. This is a print formatter. Uses XSL-FO (XSL Formatting Objects) as template, and supports pdf as output. XSL-FO is a language for formatting XML data.

making ePub with Java API

I'm relatively new to ePub format, but if I understand well, to make programmatically an ePub starting from XHTML or PDF content could mean:
choose HTML or XHTML content and validate them with an XHTML validator (or clean them with Tydy)
choose PDF file to insert in the ePub
create the XML manifest or XML packing files and TOC file
zip the whole files in a .epub file
validate the ePub (I saw something in Google code)
So my question is if there is some sort of high level Java API to do these steps. Sure I can use API for ZIP, XML in Java, but does it exist higher tools?
thanks a lot
------ EDIT -------
I've developed an open source project to do that!
http://scribaebookmake.sourceforge.net/
I haven't seen a java epub toolchain; however, I have been having good success with Sigil.
If the goal is to make an epub, I'd give Sigil a go. Before I used it I was rolling my epubs by hand (with the automation of an ant build.xml).
If the goal is to make a java based epub toolchain, then it shouldn't be terribly hard, depending on how much validation and pipelining you wish to do. Personally, I'd start with writing an epub viewer.
As far as the PDF parts go, I just embed XHTML. Haven't had a need for embedding PDF yet. As far as epub validation goes, if all the xml is valid and there's no dangling links prior to zipping, you're going to have a valid epub.
You should take a look at this project which seemed to be converting PDF to epub.
The following is a shameless plug for a project that I've been working on myself. It is basically EPUB tooling written in Java, for Eclipse. It comes with an API, UI and an Ant task that allows you to do pretty much everything. See http://help.eclipse.org/kepler/topic/org.eclipse.mylyn.docs.epub.help/help/introduction.html

Categories

Resources