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.
Related
I'm using selectPDF html to pdf converter to convert an svg document to pdf. I'm using the webkitRestricted browser engine to ensure it runs correctly on azure. Generally speaking, everything is working correctly, including using pattern definitions. I recently added the use of the patternTransform attribute with the rotate option. This does not appear to be recognized by the webkitrestricted engine and is not working. If i take the underlying html into either firefox or chrome latest versions, the patternTransform attribute does function correctly. Is there a way to overcome this issue using selectpdf ? I'm not clear which version of webkit is being called by selectpdf and whether i can control this in any fashion ?
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
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.
I've been searching through the vtk documentation but I cannot see how I can use a PNG image with a vtkFollower.
In order to do so, I seem to need to obtain a vtkMapper with the image data. However, there does not seem to be a mapper for this purpose (i.e. loading of images).
How can I get a vtkFollower of type image?
Note: vtkFollower.SetMapper expects vtkMapper. Since vtkImageMapper does not inherit from vtkMapper, using vtkImageMapper is not possible.
You have to use PNG reader and pass it to texture.
Then, In vtkfollower object "settexture" should be called.
Please refer to links below.
https://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/PNGReader
https://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TextureMapPlane
https://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Follower
I am using Raphael to create a dynamic visualization. Is it possible to allow the image generated on the Canvas to be downloaded as a SVG/PDF or another image format?
There are pieces of information missing here, namely browser support, server-/client-side solution and whether costs are okay or not. So I'll try to give you an exhaustive answer.
For a client-side solution, you can use DocRaptor. Just feed the SVG tree to DocRaptor This works for the SVG-producing browsers (all since 2005 except for IE prior to version 9). Note that DocRaptor has a fee for converting documents into PDF. For a free server-side solution for converting an SVG tree to a PDF, I would suggest using wkhtmltopdf as proposed in this answer.
For IE6-8, which Raphaƫl produces VML for, you could create a PHP solution using the Vector Converter library. When the conversion from VML to SVG is finished, sent the SVG to DocRaptor (or wkhtmltopdf).
There is no free client-side VML/SVG -> PDF solution that works for VML or SVG. To build that would mean interpreting SVG and/or VML, creating a PDF from it using JavaScript (there are JS PDF library attempts), and sending it to the client using some Flash technique. I guess nobody has attempted to build that yet. I might.
pdfkit seems to be the way to go, with using browserify to make the node code run client side. There is a nice demo here
You can save as an image using canvg and canvas2image libraries
http://code.google.com/p/canvg/
http://www.nihilogic.dk/labs/canvas2image/