Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Javascript convert image format to .pdf

Posted on 2016-08-20
4
Medium Priority
?
1,419 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 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 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 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
This article discusses how to implement server side field validation and display customized error messages to the client.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
Suggested Courses

926 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