To make the letters in a document image appear clearly in canvas - javascript

I am displaying the color JPG image of A4 document on canvas.
However, the letters of the image shown in canvas are not clear.
Recently, I saw the content of image resample through javascript.
Please help me with how to make the characters inside the document image clear using the image filter.

Related

JSPDF image can't fit and to large

I have a problem with my project, and it is about converting the html file to pdf. I have one question, how can we alter the size of image in jspdf because when i'm downloading the pdf, it show that the image is not fit in the page and only show half of it for A4.then, i'm trying using the A0 size but the font will become very small even though the image is right. can some one tell how to fit the image or maybe changing the font size?
(and also i'm using HTMLfromPdf.js)
You can resize the canvas image using the method parameters,
pdf.addImage(imgData,'JPEG',0,0,canvas.width*0.2,canvas.height*0.2,"a","FAST");
You can calculate the required ratio and replace the image width and height parameters.
You can use dimensions for jsPDF directly from canvas object like described there
https://stackoverflow.com/a/65124814/9026103.

SVG from web to print

I am developing an online restaurant menu editor. The template is SVG, with a jpeg image of the menu as the background. The user is able to edit the text which is SVG text elements laid on top of the template image.
I am able to create a PDF from this SVG, for the user to see, just fine. Now I want to drop the low resolution background image out of the SVG and place the remaining text into a high resolution print, ready pdf for printing. The problem is the text does not appear in the right place in the print ready file. Nor is it the same size.
I am using the ColdFusion CFPdftag to place the text using the watermark feature. I have tested this and it works fine. It's just the size and coordinates that are off. I know this is because of the resolution but how do I get it to work? There might even be a better way, I don't know.
I figured out that I needed to change the viewport in the svg to the actual size of the hi res pdf instead of leaving it at the low res pixel size I had it at for the web.

Drag and drop a canvas like an image

Our company's website uses canvas elements to render graphs and charts on our pages. However, these cannot be drag-and-dropped into, say, a Microsoft Word Document or an email client. So I devised a way to replace the canvas with an identical-looking img on mouse down, by getting the base64 data from the canvas.
The canvas is properly replaced by an image on mousedown, and placed back on mouseup. However, this does not allow dragging and dropping the image tag, probably because the replacement happens too late.
Here is a working JSFiddle example.
We use a plugin which also provides tooltips to specific areas of the charts, so I cannot replace the elements on hover in/hover out, as that would stop the tooltips from working.
How do I make dragging and dropping the image itself possible?
Prebuild your img elements at the start of your app instead of taking the time to do it "on-the-fly".
Create your charts using in-memory canvases:
var canvas1=document.createElement('canvas');
// draw your chart on canvas1
Then create img elements from the canvases
var chart1=new Image();
document.body.appendChild(chart1);
chart1.src=canvas1.toDataURL();
your code is working correctly but you can't drop the image onto word because IMO the image is base64, you'll see that if you drag and drop the image onto a new tab in the browser or add a css border or the image id
The Image:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAAGQCAYAAAA9TUphAAAgAElEQVR4Xu3dsW5bURBDQfvP/edJHSCFYFnW4WJSJ/a+IRviFvn88IcAAQIECBAgQIAAAQIECBB4u8Dn2y9wAAECBAgQIECAAAECBAgQIPBhoCsBAQIECBAgQIAAAQIECBAICBjogRCcQIAAAQIECBAgQIAAAQIEDHQdIECAAAECBAgQIECAAAECAQEDPRCCEwgQIECAAAECBAgQIECAgIGuAwQIECBAgAABAgQIECBAICBgoAdCcAIBAgQIECBAgAABAgQIEDDQdYAAAQIECBAgQIAAAQIECAQEDPRACE4gQIAAAQIECBAgQIAAAQKPD/Svjz+4QgJf/g/7UBpOIUCAAAECBAgQIECAwNMCBvrThG/6AQb6m+D9WgIECBAgQIAAAQIECLxGwEB/jevrf6qB/npjv4EAAQIECBAgQIAAAQK/KGCg/yL2j/4qA/1HOf0wAgQIECBAgAABAgQIvFvAQH93At/9/Qb6d+X8OwIECBAgQIAAAQIECCQFDPRkLA8cZaA/gOSvECBAgAABAgQIECBAYEfAQN/J6t9LDfTV5NxNgAABAgQIECBAgACB/woY6KvFMNBXk3M3AQIECBAgQIAAAQIEDPRTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQ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RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQICAF/RTHTDQT8XpYwgQIECAAAECBAgQIOAFfbUDBvpqcu4mQIAAAQIECBAgQIDAky/oAAkQIECAAAECBAgQIECAAIGXCTz+gv6yE/xgAgQIECBAgAABAgQIECBAwEDXAQIECBAgQIAAAQIECBAgEBAw0AMhOIEAAQIECBAgQIAAAQIECBjoOkCAAAECBAgQIECAAAECBAICBnogBCcQIECAAAECBAgQIECAAAEDXQcIECBAgAABAgQIECBAgEBAwEAPhOAEAgQIECBAgAABAgQIECBgoOsAAQIECBAgQIAAAQIECBAICBjogRCcQIAAAQIECBAgQIAAAQIEDHQdIECAAAECBAgQIECAAAECAQEDPRCCEwgQIECAAAECBAgQIECAgIGuAwQIECBAgAABAgQIECBAICBgoAdCcAIBAgQIECBAgAABAgQIEDDQdYAAAQIECBAgQIAAAQIECAQEDPRACE4gQIAAAQIECBAgQIAAAQIGug4QIECAAAECBAgQIECAAIGAgIEeCMEJBAgQIECAAAECBAgQIEDAQNcBAgQIECBAgAABAgQIECAQEDDQAyE4gQABAgQIECBAgAABAgQIGOg6QIAAAQIECBAgQIAAAQIEAgIGeiAEJxAgQIAAAQIECBAgQIAAAQNdBwgQIECAAAECBAgQIECAQEDAQA+E4AQCBAgQIECAAAECBAgQIGCg6wABAgQIECBAgAABAgQIEAgIGOiBEJxAgAABAgQIECBAgAABAgQMdB0gQIAAAQIECBAgQIAAAQIBAQM9EIITCBAgQIAAAQIECBAgQICAga4DBAgQIECAAAECBAgQIEAgIGCgB0JwAgECBAgQIECAAAECBAgQMNB1gAABAgQIECBAgAABAgQIBAQM9EAITiBAgAABAgQIECBAgAABAga6DhAgQIAAAQIECBAgQIAAgYCAgR4IwQkECBAgQIAAAQIECBAgQMBA1wECBAgQIECAAAECBAgQIBAQMNADITiBAAECBAgQIECAAAECBAgY6DpAgAABAgQIECBAgAABAgQCAgZ6IAQnECBAgAABAgQIECBAgAABA10HCBAgQIAAAQIECBAgQIBAQMBAD4TgBAIECBAgQIAAAQIECBAgYKDrAAECBAgQIECAAAECBAgQCAgY6IEQnECAAAECBAgQIECAAAECBAx0HSBAgAABAgQIECBAgAABAgEBAz0QghMIECBAgAABAgQIECBAgICBrgMECBAgQIAAAQIECBAgQCAgYKAHQnACAQIECBAgQIAAAQIECBAw0HWAAAECBAgQIECAAAECBAgEBAz0QAhOIECAAAECBAgQIECAAAECBroOECBAgAABAgQIECBAgACBgICBHgjBCQQIECBAgAABAgQIECBAwEDXAQIECBAgQIAAAQIECBAgEBAw0AMhOIEAAQIECBAgQIAAAQIECBjoOkCAAAECBAgQIECAAAECBAICBnogBCcQIECAAAECBAgQIECAAAEDXQcIECBAgAABAgQIECBAgEBAwEAPhOAEAgQIECBAgAABAgQIECBgoOsAAQIECBAgQIAAAQIECBAICBjogRCcQIAAAQIECBAgQIAAAQIEDHQdIECAAAECBAgQIECAAAECAQEDPRCCEwgQIECAAAECBAgQIECAgIGuAwQIECBAgAABAgQIECBAICBgoAdCcAIBAgQIECBAgAABAgQIEDDQdYAAAQIECBAgQIAAAQIECAQEDPRACE4gQIAAAQIECBAgQIAAAQIGug4QIECAAAECBAgQIECAAIGAgIEeCMEJBAgQIECAAAECBAgQIEDAQNcBAgQIECBAgAABAgQIECAQEDDQAyE4gQABAgQIECBAgAABAgQIGOg6QIAAAQIECBAgQIAAAQIEAgIGeiAEJxAgQIAAAQIECBAgQIAAAQNdBwgQIECAAAECBAgQIECAQEDAQA+E4AQCBAgQIECAAAECBAgQIGCg6wABAgQIECBAgAABAgQIEAgIGOiBEJxAgAABAgQIECBAgAABAgQMdB0gQIAAAQIECBAgQIAAAQIBAQM9EIITCBAgQIAAAQIECBAgQICAga4DBAgQIECAAAECBAgQIEAgIGCgB0JwAgECBAgQIECAAAECBAgQMNB1gAABAgQIECBAgAABAgQIBAQM9EAITiBAgAABAgQIECBAgAABAga6DhAgQIAAAQIECBAgQIAAgYCAgR4IwQkECBAgQIAAAQIECBAgQMBA1wECBAgQIECAAAECBAgQIBAQMNADITiBAAECBAgQIECAAAECBAgY6DpAgAABAgQIECBAgAABAgQCAgZ6IAQnECBAgAABAgQIECBAgAABA10HCBAgQIAAAQIECBAgQIBAQMBAD4TgBAIECBAgQIAAAQIECBAgYKDrAAECBAgQIECAAAECBAgQCAgY6IEQnECAAAECBAgQIECAAAECBAx0HSBAgAABAgQIECBAgAABAgEBAz0QghMIECBAgAABAgQIECBAgICBrgMECBAgQIAAAQIECBAgQCAgYKAHQnACAQIECBAgQIAAAQIECBAw0HWAAAECBAgQIECAAAECBAgEBAz0QAhOIECAAAECBAgQIECAAAECBroOECBAgAABAgQIECBAgACBgICBHgjBCQQIECBAgAABAgQIECBAwEDXAQIECBAgQIAAAQIECBAgEBAw0AMhOIEAAQIECBAgQIAAAQIECBjoOkCAAAECBAgQIECAAAECBAICBnogBCcQIECAAAECBAgQIECAAAEDXQcIECBAgAABAgQIECBAgEBAwEAPhOAEAgQIECBAgAABAgQIECBgoOsAAQIECBAgQIAAAQIECBAICBjogRCcQIAAAQIECBAgQIAAAQIEDHQdIECAAAECBAgQIECAAAECAQEDPRCCEwgQIECAAAECBAgQIECAgIGuAwQIECBAgAABAgQIECBAICBgoAdCcAIBAgQIECBAgAABAgQIEDDQdYAAAQIECBAgQIAAAQIECAQEDPRACE4gQIAAAQIECBAgQIAAAQIGug4QIECAAAECBAgQIECAAIGAgIEeCMEJBAgQIECAAAECBAgQIEDAQNcBAgQIECBAgAABAgQIECAQEDDQAyE4gQABAgQIECBAgAABAgQIGOg6QIAAAQIECBAgQIAAAQIEAgIGeiAEJxAgQIAAAQIECBAgQIAAAQNdBwgQIECAAAECBAgQIECAQEDAQA+E4AQCBAgQIECAAAECBAgQIGCg6wABAgQIECBAgAABAgQIEAgIGOiBEJxAgAABAgQIECBAgAABAgQMdB0gQIAAAQIECBAgQIAAAQIBAQM9EIITCBAgQIAAAQIECBAgQICAga4DBAgQIECAAAECBAgQIEAgIGCgB0JwAgECBAgQIECAAAECBAgQMNB1gAABAgQIECBAgAABAgQIBAQM9EAITiBAgAABAgQIECBAgAABAga6DhAgQIAAAQIECBAgQIAAgYCAgR4IwQkECBAgQIAAAQIECBAgQMBA1wECBAgQIECAAAECBAgQIBAQMNADITiBAAECBAgQIECAAAECBAgY6DpAgAABAgQIECBAgAABAgQCAgZ6IAQnECBAgAABAgQIECBAgAABA10HCBAgQIAAAQIECBAgQIBAQMBAD4TgBAIECBAgQIAAAQIECBAgYKDrAAECBAgQIECAAAECBAgQCAgY6IEQnECAAAECBAgQIECAAAECBAx0HSBAgAABAgQIECBAgAABAgEBAz0QghMIECBAgAABAgQIECBAgICBrgMECBAgQIAAAQIECBAgQCAgYKAHQnACAQIECBAgQIAAAQIECBAw0HWAAAECBAgQIECAAAECBAgEBAz0QAhOIECAAAECBAgQIECAAAECBroOECBAgAABAgQIECBAgACBgICBHgjBCQQIECBAgAABAgQIECBAwEDXAQIECBAgQIAAAQIECBAgEBAw0AMhOIEAAQIECBAgQIAAAQIECBjoOkCAAAECBAgQIECAAAECBAICBnogBCcQIECAAAECBAgQIECAAAEDXQcIECBAgAABAgQIECBAgEBAwEAPhOAEAgQIECBAgAABAgQIECBgoOsAAQIECBAgQIAAAQIECBAICBjogRCcQIAAAQIECBAgQIAAAQIEDHQdIECAAAECBAgQIECAAAECAQEDPRCCEwgQIECAAAECBAgQIECAgIGuAwQIECBAgAABAgQIECBAICBgoAdCcAIBAgQIECBAgAABAgQIEDDQdYAAAQIECBAgQIAAAQIECAQEDPRACE4gQIAAAQIECBAgQIAAAQIGug4QIECAAAECBAgQIECAAIGAgIEeCMEJBAgQIECAAAECBAgQIEDAQNcBAgQIECBAgAABAgQIECAQEDDQAyE4gQABAgQIECBAgAABAgQIGOg6QIAAAQIECBAgQIAAAQIEAgIGeiAEJxAgQIAAAQIECBAgQIAAAQNdBwgQIECAAAECBAgQIECAQEDAQA+E4AQCBAgQIECAAAECBAgQIGCg6wABAgQIECBAgAABAgQIEAgIGOiBEJxAgAABAgQIECBAgAABAgQMdB0gQIAAAQIECBAgQIAAAQIBAQM9EIITCBAgQIAAAQIECBAgQICAga4DBAgQIECAAAECBAgQIEAgIGCgB0JwAgECBAgQIECAAAECBAgQMNB1gAABAgQIECBAgAABAgQIBAQM9EAITiBAgAABAgQIECBAgAABAga6DhAgQIAAAQIECBAgQIAAgYCAgR4IwQkECBAgQIAAAQIECBAgQMBA1wECBAgQIECAAAECBAgQIBAQMNADITiBAAECBAgQIECAAAECBAgY6DpAgAABAgQIECBAgAABAgQCAgZ6IAQnECBAgAABAgQIECBAgAABA10HCBAgQIAAAQIECBAgQIBAQMBAD4TgBAIECBAgQIAAAQIECBAgYKDrAAECBAgQIECAAAECBAgQCAgY6IEQnECAAAECBAgQIECAAAECBAx0HSBAgAABAgQIECBAgAABAgEBAz0QghMIECBAgAABAgQIECBAgICBrgMECBAgQIAAAQIECBAgQCAgYKAHQnACAQIECBAgQIAAAQIECBAw0HWAAAECBAgQIECAAAECBAgEBAz0QAhOIECAAAECBAgQIECAAAECBroOECBAgAABAgQIECBAgACBgICBHgjBCQQIECBAgAABAgQIECBAwEDXAQIECBAgQIAAAQIECBAgEBAw0AMhOIEAAQIECBAgQIAAAQIECBjoOkCAAAECBAgQIECAAAECBAICBnogBCcQIECAAAECBAgQIECAAAEDXQcIECBAgAABAgQIECBAgEBAwEAPhOAEAgQIECBAgAABAgQIECBgoOsAAQIECBAgQIAAAQIECBAICBjogRCcQIAAAQIECBAgQIAAAQIEDHQdIECAAAECBAgQIECAAAECAQEDPRCCEwgQIECAAAECBAgQIECAgIGuAwQIECBAgAABAgQIECBAICBgoAdCcAIBAgQIECBAgAABAgQIEDDQdYAAAQIECBAgQIAAAQIECAQEDPRACE4gQIAAAQIECBAgQIAAAQIGug4QIECAAAECBAgQIECAAIGAgIEeCMEJBAgQIECAAAECBAgQIEDAQNcBAgQIECBAgAABAgQIECAQEDDQAyE4gQABAgQIECBAgAABAgQIGOg6QIAAAQIECBAgQIAAAQIEAgIGeiAEJxAgQIAAAQIECBAgQIAAAQNdBwgQIECAAAECBAgQIECAQEDAQA+E4AQCBAgQIECAAAECBAgQIGCg6wABAgQIECBAgAABAgQIEAgIGOiBEJxAgAABAgQIECBAgAABAgQMdB0gQIAAAQIECBAgQIAAAQIBAQM9EIITCBAgQIAAAQIECBAgQICAga4DBAgQIECAAAECBAgQIEAgIGCgB0JwAgECBAgQIECAAAECBAgQMNB1gAABAgQIECBAgAABAgQIBAQM9EAITiBAgAABAgQIECBAgAABAga6DhAgQIAAAQIECBAgQIAAgYCAgR4IwQkECBAgQIAAAQIECBAgQMBA1wECBAgQIECAAAECBAgQIBAQMNADITiBAAECBAgQIECAAAECBAgY6DpAgAABAgQIECBAgAABAgQCAgZ6IAQnECBAgAABAgQIECBAgAABA10HCBAgQIAAAQIECBAgQIBAQMBAD4TgBAIECBAgQIAAAQIECBAgYKDrAAECBAgQIECAAAECBAgQCAgY6IEQnECAAAECBAgQIECAAAECBAx0HSBAgAABAgQIECBAgAABAgEBAz0QghMIECBAgAABAgQIECBAgICBrgMECBAgQIAAAQIECBAgQCAgYKAHQnACAQIECBAgQIAAAQIECBAw0HWAAAECBAgQIECAAAECBAgEBAz0QAhOIECAAAECBAgQIECAAAECBroOECBAgAABAgQIECBAgACBgICBHgjBCQQIECBAgAABAgQIECBAwEDXAQIECBAgQIAAAQIECBAgEBAw0AMhOIEAAQIECBAgQIAAAQIECBjoOkCAAAECBAgQIECAAAECBAICBnogBCcQIECAAAECBAgQIECAAAEDXQcIECBAgAABAgQIECBAgEBAwEAPhOAEAgQIECBAgAABAgQIECBgoOsAAQIECBAgQIAAAQIECBAICBjogRCcQIAAAQIECBAgQIAAAQIEDHQdIECAAAECBAgQIECAAAECAQEDPRCCEwgQIECAAAECBAgQIECAgIGuAwQIECBAgAABAgQIECBAICBgoAdCcAIBAgQIECBAgAABAgQIEDDQdYAAAQIECBAgQIAAAQIECAQEDPRACE4gQIAAAQIECBAgQIAAAQIGug4QIECAAAECBAgQIECAAIGAgIEeCMEJBAgQIECAAAECBAgQIEDAQNcBAgQIECBAgAABAgQIECAQEDDQAyE4gQABAgQIECBAgAABAgQIGOg6QIAAAQIECBAgQIAAAQIEAgIGeiAEJxAgQIAAAQIECBAgQIAAAQNdBwgQIECAAAECBAgQIECAQEDAQA+E4AQCBAgQIECAAAECBAgQIGCg6wABAgQIECBAgAABAgQIEAgIGOiBEJxAgAABAgQIECBAgAABAgQMdB0gQIAAAQIECBAgQIAAAQIBAQM9EIITCBAgQIAAAQIECBAgQICAga4DBAgQIECAAAECBAgQIEAgIGCgB0JwAgECBAgQIECAAAECBAgQMNB1gAABAgQIECBAgAABAgQIBAQM9EAITiBAgAABAgQIECBAgAABAga6DhAgQIAAAQIECBAgQIAAgYCAgR4IwQkECBAgQIAAAQIECBAgQMBA1wECBAgQIECAAAECBAgQIBAQMNADITiBAAECBAgQIECAAAECBAgY6DpAgAABAgQIECBAgAABAgQCAgZ6IAQnECBAgAABAgQIECBAgAABA10HCBAgQIAAAQIECBAgQIBAQMBAD4TgBAIECBAgQIAAAQIECBAgYKDrAAECBAgQIECAAAECBAgQCAgY6IEQnECAAAECBAgQIECAAAECBAx0HSBAgAABAgQIECBAgAABAgEBAz0QghMIECBAgAABAgQIECBAgICBrgMECBAgQIAAAQIECBAgQCAgYKAHQnACAQIECBAgQIAAAQIECCtJVbsAAABWSURBVBAw0HWAAAECBAgQIECAAAECBAgEBAz0QAhOIECAAAECBAgQIECAAAECBroOECBAgAABAgQIECBAgACBgICBHgjBCQQIECBAgAABAgQIECBA4C+co8mRzOcVPQAAAABJRU5ErkJggg==
If you copy the above base64 code and paste it in the browser address bar it will render just fine, but if you do the same in word it won't work, so you need to decode the image first before showing it on mouse down
for more information:
Base64 encoding / decoding with javascript
Base64 encoding and decoding in client-side Javascript
Edit:
You can right click on the canvas and then save image as, thus it will be saved as an image file

How to remove text over an image from Canvas

After searching for placing text over an image in Canvas I found this snippet
jsfiddle.net/m1erickson/pQYz9/ (found it on stackoverflow, I lost the question)
This snippet places any amount of text over an image. Is it possible to show a cross over each textbox? so that I can remove the selected text by pressing it. The closet answer I found is on this post. But this post talks about clearing the whole canvas and redrawing everything except for the item that you want to remove.
how to remove text from canvas in javascript
My end goal is to have have an app where you can upload an image as a background, place some text on it anywhere you want and then save that canvas as an image.

How can I scale/enlarge HTML content and save it as an image?

I have a JavaScript product designer that allows the web page user to add text and images to create a dynamic promo product. The design phase works great, and I use html2canvas to turn their custom product into an image. The image looks great for the screen but is not suitable for printing, which is the ultimate goal.
How can I scale up HTML content (retaining the detail) and save the results as an image (png) ?
I have successfully scaled the image AFTER putting the web content on a canvas, but that clearly loses detail.
I have used the CSS3 "transform" property to scale my image BEFORE applying the content to the canvas. That works and retains the detail and proportions nicely. However, html2canvas ignores that CSS and exports the original size (as confirmed here: https://github.com/niklasvh/html2canvas/issues/176 )
Anyone have experience doing this?

Categories

Resources