Active8 months ago
I am searching for a JavaScript library that is similar to
pdf.js
but allows the viewing of Word Documents (.doc and .docx)Are there any?
UPDATE:
Like giving them 5 seconds to open the Word document and save it as a PDF, after 5 seconds the process would be killed if still active. I've dealt with something similiar in the past and the solution for that included a 'kill word processes batch script' to kill any WORD processes that were stuck after the program ended. Convert html table to word document or editable pdf. Browse other questions tagged javascript jquery html pdf ms-word or ask your own. Convert HTML to PDF in.
Use this smart and simple-to-use tool to convert DOC to PDF without any doubts concerning the security of your files. All users' privacy is of high importance to us – none of your files or their contents will be used for any purposes other than the major one: Word to PDF conversion. My problem is that ViewerJS is limited in terms of which document types can be viewed. I can use it to view pdf documents and open data file formats such as (odt for MS Word). However, I can't rely upon users to save their Word documents as either pdf or odt files before uploading them.
![Convert word to pdf using javascript Convert word to pdf using javascript](/uploads/1/2/4/9/124914721/665965743.jpg)
There is an interesting library called DOCX.js
But I'm searching for something more advanced.
Lee Taylor5,77077 gold badges2525 silver badges4343 bronze badges
obenjiroobenjiro2,22455 gold badges3838 silver badges7474 bronze badges
5 Answers
I doubt it. Behind pdf.js stands Mozilla, so it isn't a weekend project.
There are ambitions to let LibreOffice run in the browser, but I don't know the maturity of that project.
Javascript Create Pdf From Html
Then you have Google Docs to import the Word file and let it be displayed there, but there is no way to embed that easily or even host the code yourself. (Also, as I understand it, there are transformations to the Word file on the server involved.)
And after all, if you compare the PDF spec with the OpenXML (aka .docx) spec, it becomes quite clear, that a fully compliant viewer will be a complex beast, to say the least.
BoldewynBoldewyn56k3838 gold badges126126 silver badges194194 bronze badges
I just found out ViewerJS, but it only supports OpenDocument formats. It's not what you were looking for, but may be worth a shot, specially if you can find a way to convert odt to doc (this question might help).
Community♦
keplerkepler
At a glance, it looks like Flexpaper can be used to this effect, but it's effectively using a server-side version of open office to convert the document into images that can be viewed on the web. This'll work in a pinch, but certainly lacks the quality of pdf.js.
BubblesBubbles3,51011 gold badge1919 silver badges2525 bronze badges
You can use ViewerJS and JOD Converter (http://www.artofsolving.com/opensource/jodconverter.html) together to achieve requirement. First you can convert office documents to open office or pdf format using above converter. Then you can show those documents with the help of either pdf.js or ViewerJS
Nisarg VinodNisarg Vinod
Native Documents (in which I have an interest) makes an embeddable viewer/editor for Word documents. There's an online demo where you can try your own document.
JasonPlutextJasonPlutext12.6k33 gold badges3030 silver badges6666 bronze badges
Not the answer you're looking for? Browse other questions tagged javascripthtmlhtml5canvas or ask your own question.
Active5 months ago
How can I convert a Word document to PDF where the document contains various things, such as tables. When trying to use iText, the original document looks different to the converted PDF. Is there an open source API / library, rather than calling out to an executable, that I can use?
RobHtml Form To Pdf Javascript
38.7k2222 gold badges105105 silver badges134134 bronze badges
maghmagh28922 gold badges1010 silver badges1616 bronze badges
11 Answers
This is quite a hard task, ever harder if you want perfect results (impossible without using Word) as such the number of APIs that just do it all for you in pure Java and are open source is zero I believe (Update: I am wrong, see below).
Your basic options are as follows:
- Using JNI/a C# web service/etc script MS Office (only option for 100% perfect results)
- Using the available APIs script Open Office (90+% perfect)
- Use Apache POI & iText (very large job, will never be perfect).
Update - 2016-02-11Here is a cut down copy of my blog post on this subject which outlines existing products that support Word-to-PDF in Java.
Three products that I know of can render Office documents:
yeokm1/docs-to-pdf-converterIrregularly maintained, Pure Java, Open SourceTies together a number of libraries to perform the conversion.
xdocreportActively developed, Pure Java, Open SourceIt's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML..).
Snowbound Imaging SDKClosed Source, Pure JavaSnowbound appears to be a 100% Java solution and costs over $2,500. It contains samples describing how to convert documents in the evaluation download.
OpenOffice APIOpen Source, Not Pure Java - Requires Open Office installedOpenOffice is a native Office suite which supports a Java API. This supports reading Office documents and writing PDF documents. The SDK contains an example in document conversion (examples/java/DocumentHandling/DocumentConverter.java). To write PDFs you need to pass the 'writer_pdf_Export' writer rather than the 'MS Word 97' one.Or you can use the wrapper API JODConverter.
JDocToPdf - Dead as of 2016-02-11Uses Apache POI to read the Word document and iText to write the PDF. Completely free, 100% Java but has some limitations.
Michael Lloyd Lee mlkMichael Lloyd Lee mlk13.3k22 gold badges3434 silver badges7777 bronze badges
You can use JODConverter for this purpose. It can be used to convert documents between different office formats. such as:
- Microsoft Office to OpenDocument, and vice versa
- Any format to PDF
- And supports many more conversion as well
- It can also convert MS office 2007 documents to PDF as well with almost all formats
More details about it can be found here: http://www.artofsolving.com/opensource/jodconverter
NodexpertNodexpert
Check out docs-to-pdf-converter on github. Its a lightweight solution designed specifically for converting documents to pdf.
Why?
I wanted a simple program that can convert Microsoft Office documents to PDF but without dependencies like LibreOffice or expensive proprietary solutions. Seeing as how code and libraries to convert each individual format is scattered around the web, I decided to combine all those solutions into one single program. Along the way, I decided to add ODT support as well since I encountered the code too.
Sudarshan_SMDSudarshan_SMD
You can use Cloudmersive native Java library. It is free for up to 50,000 conversions/month and is much higher fidelity in my experience than other things like iText or Apache POI-based methods. The documents actually look the same as they do in Microsoft Word which for me is the key. Incidentally it can also do XLSX, PPTX, and the legacy DOC, XLS and PPT conversion to PDF.
Here is what the code looks like, first add your imports:
Then convert a file:
You can get an document conversion API key for free from the portal.
JohnnyJohnny6,01266 gold badges4949 silver badges8181 bronze badges
I agree with posters listing OpenOffice as a high-fidelity import/export facility of word / pdf docs with a Java API and it also works across platforms. OpenOffice import/export filters are pretty powerful and preserve most formatting during conversion to various formats including PDF. Docmosis and JODReports value-add to make life easier than learning the OpenOffice API directly which can be challenging because of the style of the UNO api and the crash-related bugs.
![Convert Convert](/uploads/1/2/4/9/124914721/209084842.png)
Convert Word To Pdf Javascript Online
Paul JowettPaul Jowett5,98222 gold badges1717 silver badges1818 bronze badges
I think JOD Converter is easiest way to implement, Please refer below link for more information.
If the boiler was manufactured from 1984 to 1999, the serial number ends in a four digit date code. “1 ” would be manufactured in December, 1984. If the boiler was manufactured from 2000 to present, the serial number ends in a six digit date code. “105 ” would be manufactured in. Single Boiler Primary Secondary 35449 RBI Water Heaters Piping Diagram 8900/8800, All Products, Dominator, Futera II, Futera III, Futera XLF, LCD - Dominator Series, Spectrum All Models H-1. R.B.I.® How to determine the date of production/manufacture or age of R.B.I.® HVAC Systems. The date of production/manufacture or age of R.B.I.® HVAC equipment can be determined from the serial number located on the data plate. Direct all questions to your RBI distributor or contact the RBI Cus-tomer Service Department, 260 North Elm Street, Westfi eld, MA 01085 for U.S. Or 7555 Tranmere Drive, Mississauga, ONT L5S 1L4 for Canada. Always include the model and serial numbers from the rating plate of the boiler/water heater in question. RATINGS & CAPACITIES. RBI’s full line of energy efficient boilers, hot water heaters and storage tanks are sized from 250-4,000 MBH to tackle the toughest commercial applications. Serial number idm gratis.
Selvakumar PonnusamySelvakumar Ponnusamy2,77155 gold badges2626 silver badges5555 bronze badges
Using JACOB call Office Word is a 100% perfect solution. But it only supports on Windows platform because need Office Word installed.
- Download JACOB archive (the latest version is 1.19);
- Add jacob.jar to your project classpath;
- Add jacob-1.19-x32.dll or jacob-1.19-x64.dll (depends on your jdk version) to ..Javajdk1.x.x_xxxjrebin
- Using JACOB API call Office Word to convert doc/docx to pdf. Gigabyte technology motherboard drivers.}
Charles WangCharles Wang
I haven't tried using it for MS Word, but I've had good success reading MS Excel documents using Apache POI - http://poi.apache.org/
CurtisCurtis3,45811 gold badge1414 silver badges2525 bronze badges
Look into scripting OpenOffice.org to do the job for you.
Thorbjørn Ravn AndersenThorbjørn Ravn Andersen58.2k2525 gold badges155155 silver badges298298 bronze badges
unoconv, it's a python tool worked in UNIX.While I use Java to invoke the shell in UNIX, it works perfect for me. My source code : UnoconvTool.java. Both JODConverter and unoconv are said to use open office/libre office.
docx4j/docxreport, POI, PDFBox are good but they are missing some formats in conversion.
It's already 2019, I can't believe still no easiest and conveniencest way to convert the most popular Micro$oft Word document to Adobe PDF format in Java world.
I almost tried every method the above answers mentioned, and I found the best and the only way can satisfy my requirement is by using OpenOffice or LibreOffice. Actually I am not exactly know the difference between them, seems both of them provide
soffice
command line.My requirement is:
- It must run on Linux, more specifically CentOS, not on Windows, thus we cannot install Microsoft Office on it;
- It must support Chinese character, so ISO-8859-1 character encoding is not a choice, it must support Unicode.
First thing came in mind is
doc-to-pdf-converter
, but it lacks of maintenance, last update happened 4 years ago, I will not use a nobody-maintain-solution. Xdocreport
seems a promising choice, but it can only convert docx
, but not doc
binary file which is mandatory for me. Using Java to call OpenOffice API seems good, but too complicated for such a simple requirement.Finally I found the best solution: use OpenOffice command line to finish the job:
I always believe the shortest code is the best code (of course it should be understandable), that's it.
Zhang BuzzZhang Buzz3,40933 gold badges2020 silver badges3333 bronze badges
protected by Community♦Apr 22 '14 at 11:01
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?