Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Javascript convert image format to .pdf

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

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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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.
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
Suggested Courses

670 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