Solved

Javascript convert image format to .pdf

Posted on 2016-08-20
4
651 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 53

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 54

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
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.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

729 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