Solved

Javascript convert image format to .pdf

Posted on 2016-08-20
4
228 Views
Last Modified: 2016-08-21
Hello,  
Thanks for reading my post.  
Does anyone have example javascript code to convert image files to .pdf; example image format files are JPG, PNG, BMP, GIF, TIFF?  An example of the use case is employee expense reimbursement.  An employee digitizes their cash receipts; scenario A - captures an image of a cab ride receipt with his/her cell phone and scenario B - scans a hotel invoice with a mobile personal scanner.  The employee attaches two image format files to an e-mail requesting reimbursement.  The corporate accounts payable associate uses a workstation desktop image to pdf conversion utility to compile both images into a single .PDF file.   The single .PDF file is later uploaded into a Document Imaging Software.
0
Comment
Question by:jrbledsoe001
4 Comments
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 41763864
The answer is it depends.

If you are talking about Javascript when it runs on the client (browser) you will not be able to do the conversion stand alone.

You will need to have something on your server that does the conversion or you send the image to a 3rd party api that does the conversion for you and use the api to both upload then download.  

If you are talking about javascript that runs server side such as node, then you can use software like http://pdfkit.org/

On my sites, I use http://www.imagemagick.org and that can be used to convert using the command line http://www.imagemagick.org/script/command-line-processing.php convert image.jpg image.pdf

I believe just about all server side languages let you run at the command line via scripting.  I use both asp and php and works perfect.
1
 
LVL 22

Expert Comment

by:Kim Walker
ID: 41764040
I'm not sure this is doable in the scenario you've outlined. There is no point at which javascript can intervene when the images are attached to an email. You may need to look into a server-side solution that would retrieve the email and process the images into a PDF, then forward the PDF to the reimbursement personnel.
0
 

Author Comment

by:jrbledsoe001
ID: 41764490
Scott,  Thank you so much for responding to my post!  This is great information and right in line with my question.
0
 
LVL 52

Expert Comment

by:Joe Winograd, EE MVE
ID: 41764501
Sorry I missed this one when it came in (don't know how that happened), but my answer would have been similar to the one in your other question:
https://www.experts-exchange.com/questions/28964547/Powershell-to-convert-image-files-to-pdf.html

Once again, good luck on the project! Regards, Joe
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to refer to value 8 51
Why doesn't Google directions work? 6 48
PHP Form Calculate Total Price 10 44
Javascript Form Change 5 23
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article discusses how to create an extensible mechanism for linked drop downs.
The goal of the tutorial is to teach the user what exposure is and how to use the exposure slider. Analyze the photo that you want to edit, then adjust the exposure slider to your liking.
The goal of the tutorial is to teach the user the full work flow of how to use flash media encoder to stream onto YouTube.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question