i'm creating a web application to generate images according to user's input, more precisely a barcode generator. i'm using javascript to process the data input by user. In the end, i want to have my output barcode as an jpg or png. What other tools do i need? I know that javascript cannot create the .jpg or .png file for me. What other tools can help me generate an image file?
Its possible using Canvas element in HTML5
http://blog.nihilogic.dk/2008/04/saving-canvas-data-to-image-file.html
I dont know i there any free script is out there but you can try this one:
http://www.java4less.com/barcodesjavascript/barcodesjavascript.php?info=intro
Hope its help,
Karls
I have created previews of user driveways after pavement using PHP GD with a picture submitted by the user.
It's done with PHP so you would POST the data to a PHP script on the server side and create the image from there.
I went as far as having the user click and make a path of the section to remove (the old driveway) and use that to cut out the driveway and replace it with a background layer.
You can set up PHP locally with Apache or IIS. PHP is pretty much standard on all hosting services.
You could build an image editor with it.
https://www.php.net/manual/en/book.image.php
Related
The use case of this problem is very simple but i struggle to find a good solution for it.
I want to allow my users (through a webapp) fill some pdf files stored in server (pdf with forms, which begin more and more popular).
Actually, app like chrome or acrobat reader are able to fill them perfectly whe its open locally.
I already allow this functionnality for docx and xlsx files, for that i use Webdav and the custom protocols ms-word ad ms-excel. It works perfectly.
For pdf, I didnt found equivalent. Its look the mains pdf reader/editor doesn't implement this protocol. Whe we open distant file with these tools, they failed for write permission when save or they try to save the file locally) .
Another option i take a look was the new file system access api (https://web.dev/file-system-access/). But again i wasn't able to make it working properly. The main problem here is how we can edit the file.? Im able with this api to dowload the file locally and keep the filehandler to retrieve the updates, but i blocked on how i can edit the file ? like an option on the fileHandler to say "Open this file with default editor on the OS". this would be perfect. But for now to edit the file i have to manually open it on the eplorer. i can't ask my end user to do that there is too many risk they edit the wrong file.
Another option on the table is the different javascript library for editing PDF, but these last one looks all very expensive, usually very heavy on the client side, with advanced features definitively i don't need. I just want to fill the forms and retrieve the pdf completed. So i would like to avoid this option.
Last option i take a look, i already use pdf.js (from mozilla) and pdf-lib.js in my app for some drawing features. I was thinking
rendering the pdf with pdf.js
retrieve all the forms fields (id, type, size, position) of the pdf with pdf-lib
generate html input write on the top of the pdf with the informations given by pdf-lib
i let the users fill the input and click on a save button whe he finished
on the save, i edit my pdf with pdf lib, i set the value of all my forms fields by taking value of the corresponding html input, and i retrieved the pdf updated.
This solution look for me the more "feasible". But im afraid of the volume of development, on how it will render, deal with zoom, rotation, etc. i would like to not have my custom solution.
I precise my webapp target chrome so it make me crazy to not be able to use the chrome pdf viewer/editor to do what i want.
PS : i struggle to post this question on stackoverflow. the previous one was deleted witout i had precise reasons. i try to be more specific on this one, but please if its such a dumb question, please answer it
I feel your pain, this is currently not possible. Adobe acrobat can open PDFs from webdav locations (simply call acrobat.exe and pass in the WebDAV UNC and it will work) but there is no way to trigger this from the browser.
If you are able to deploy software to your customers machines, you could create a custom URL scheme to do this...
I'm building a website and need to store images in it. my database gives only 512mb and I'm planning to use more images than that. I taught of the idea to store the images into dropbox and using its API to get the images and embed them into my website.
Is this possible and if it is, how can I go by doing this?
I won't show some code because I don't even know if this is possible.
Also if you have an idea of storing the images into another database or another way feel free to answer. Basically I need a way to upload images at runtime (from my website or while my website is running but without changing the code) and after that I need to display the images to the website.
You might try forwarding image to imgur or something similar and you'll probably get url back as return
I have a basic defense on the client (React.js) to check for the file and size. That provides small security as the yser can change the extension and upload any file type on the server.
I did this type of checking previously using Image Magick on the Express.js project, and that worked very nicely.
This time, I do not need all of the weapons Image magick providesm just need to make sure that the file is indeed an image. Is there an alternative?
If not, than I will end up using IM, but really would be nice to have some small sized library that just does this.
On click of a button, without doing a round trip to the server, can we save a HTML5 page on clients machine as PDF.
Check out PDF.js. This lib can create pdf in the browser (or serverside on node.js).
Using chrome you can print the page to a pdf file.
You need something like this, maybe server-side you can start a browser and print the content to a pdf file and send this to the client.
Disclaimer: i work for ByteScout
If you have simple HTML formatting and want to generate PDF on client side and if you have non-commercial project, check BytescoutPDF.js - it supports simple HTML formatting for text (font name, size, color) plus simple drawings and images, should be enough for simple reports
I want my browser to open my local images and to place them at the center of my browser. The only way I could think of is by coding an HTML+CSS file, but I don't want to use PHP or ASP.NET cause I don't want to run a server. So javascript is a solution to this.
So, is there a way for an HTML+Javascript file to display a list of my local files, and after clicking at the image I want, the image name to be saved to a variable in order to display this image to my html with img src using the css style I want?
Thanks in advance!
This is only possible with some kind of special file system that is based on XML (I've seen this once)
You need to create a XML index file (or some other format you can get with XMLHTTP Web Requests and parse with JavaScript) that contains all information about the images (System location, maybe some kind of ID, alt/title attributes etc.)
Then you load that file with a XMLHTTP Request, parse the data and print it as HTML with correct links to the images.
JavaScript itself can't read the file system, it can request single files only
Accessing local filesystem from Javascript inside a browser is a pretty taboo thing mostly. See this related question.