Add background image to existing PDF in NodeJS - node.js

I am currently trying to add a background image to an existing PDF using NodeJS, but I cannot find the right tool to get the job done.
I have looked into pdf-lib (https://pdf-lib.js.org/), but couldn't find an option to embed background images within pdf-lib's documentation.
Is there a good library to get the job done?
Alternatively, it would also be acceptable to have another PDF as background for the existing PDF, instead of having a background image.

Related

Nodejs muhammara insert SVG to pdf, or read exist PDF with PDFmake content and save it as other

I am using NodeJS and I want to modify uploaded PDF file by add svg.
I tried to use Muhammara/Hummus and it is great to edit but it can not handle SVG, only JPEG.
I also Tried PDFmake, but as far i know, I can not read PDF with this tool, just create PDF from documentData obj.
Is there any possibility accomplish mentioned goal in Nodejs?
Regards

Load image from JS to Phaser Game

I'm doing a custom game which I'd like to change the background and a character picture according to a file they upload.
The input file is outside phaser. If possible, I'd like to show the picture directly without uploading to the server.
If you use a file loader to get the base64 encoding of the image, you can use this.textures.addBase64 to load the image into the texture manager, after that loads you can create new objects with that image tag, or set existing images to that texture.
Working Example =>
https://stackblitz.com/edit/phaser-use-uploaded-image

Python docx image rendering using docx template library

I am trying to render a image to a docx template which has a jinja hook in it.
I am using inlineImage method from docx template using this I was able to render image it is opening in libreoffice writer but not in msword where it should be really using.
In msword a image is rendered but not shown just a blank area is shown.
I do even tried using the subdoc method it is also giving me same results.
Please do help me understand what am doing wrong.
I am using python-docx 0.8.7 and docxtemplate 0.5.17 library to achieve the result
I am bound to use these versions since docxtemplate enforced to use this version of python-docx
I am posting this as an answer so that it may help others trying to achieve the same.
In my code i was using NamedTemporaryFile(delete=None) to create the image before I pass the value to inlineimage as InlineImage(template, tmpfile.name) Which was causing the Issue , I remodelled my logic to directly add the image after doing some resize based on image aspect ratio and send the path of the image instead of filename into the InlineImage method and it worked like a charm.

Using node-imagemagick to 'crop' an image uploaded to S3

I'm building functionality that allows users to upload an image, then crop it to a square (for profile pictures etc...)
Currently, the process works like this:
User selects image from hd
Image is uploaded to S3
S3 Path is sent back to view, and image with jCrop is shown
On submit button being clicked, my controller action gets the coords set above
Now I'd like to crop this image to the given coords (note- I'm using lpatters fork of node-imagemagick as it contains 'offset'
Unfortunately, .crop only accepts a path - which we don't have, since it's hosted on S3 at this point.
Is there any workaround?
I saw tmp, but this may be a little overkill?
What about using some of the other entry points such as "resize" that then allow you to provide the custom arguments? I'm using streams in this code: https://github.com/jeffwilcox/4th-cloud/blob/master/lib/webserver.js#L542

Web image display in iPhone app

I am new to developing on the iPhone so am sorry if this is an easy question, but it has had me stumped for a little while.
Basically the app displays data retrieved from an XML feed. In that feed is an element that contains the path to an image. eg http://www.myserver.com/myimage.jpeg.
I want to be able to display that image in the list view of my iPhone app.
Most importantly, I don't want to stop the list drawing for each image, the rest of the data should be displayed immediately and then each image downloads and displays as quickly as data speed etc make it available.
What is the best way of downloading that image and displaying it?
Ideally can someone point to some working example code.
Thanks
Stephen
Displaying the image: you could create a UIWebView and just point it to the path - and then it's fully zoomable too.
Displaying in the list view:
//Somehow download your image...
cell.image = Your Image

Resources