How linking a image with attach files on PDF using Python? - python

how are you?
I have a problem and I don't can solved. I need to make a link between an image and attach a tiff file on using Python.
I use pyfpdf to create my PDF, and after the solution (
How to attach mulitple files in PDF?) for attaching the files that I need.
Does anyone have any suggestions? Or some example?
Thanks
Thanks

Related

How to extract all files from a p7m file

I have a bunch of p7m files (used to digitally sign some files, usually pdf files) and I would like some help to find a way to extract the content. I know how to iterate a process over the files in a folder using Python, I need help just with the extraction part.
I tried with PyPDF2.PdfFileReader.decrypt() but I get a "EOF marker not found" error because apparently PyPDF2 cannot manage encrypted files.
I saw somebody used the mime library, but that is way above my level honestly.
Thank you

pdf in python which consist data from .xlsx file and png image

I wanted to create a pdf using Python 3x.
The pdf should have some text data which is stored in a .xlsx file i.e.., it should read data from .xlsx file and write into the .pdf file.
Along with that, the pdf should have a png image of passport size.
I have come up with two basic ideas which are:-
First one is by writing a program which create a text file in which all required data from the pdf will be written along with the png image. After that the program will convert it into a pdf file.
Second one is by writing a program which will create the pdf file and write the data from .xlsx file as well as insert the image too into the pdf file.
I don't know whether these ideas can be used or not and how it can be used but after going through some researches on GFG, Stack overflow..., I have got totally confused and ended up asking this problem on this platform.
I have tried some modules like PIL, FPDF, reportlab,.. and am successfully able to create a pdf file with either texts or images but unable to combine both in the same text file.
Also I am confused in deciding which idea I should implement.
What I need from you guys is the answer of few of my questions which are:-
Are the ideas I mentioned above(second one specially) practically possible?
Can I make a program which imports data from file as well as png image into the same pdf. What modules and functions will be used there and how.
Please provide the code with comments or defining/elaborating the work of function used.
I hope I will get the desired result soon. Meanwhile I will try to solve it out by myself.

Is there a way to save an inline shape from docx as an image file?

I'm trying to parse a docx file using python-docx. The file contains images and text. Basically i need a way to take an image(an InlineShape object) from the file and save it as a separate image (like "smth.jpg"). Is there a way to do that? From reading the API docs it doesn't seem like it, but maybe i'm missing something.
docx2python will pull these images for you.
from docx2python import docx2python
content = docx2python('my_document.docx', 'output_image_directory')
The images will be in whatever directory you supply.
OK, i've figured put a way. Converting docx file to zip and extracting from there. It's not the best option, but still pretty good for me.

Saving files openoffice Python

I'm working on a script to create an OpenOffice document. After this i want to save the file. Maybe later also as an PDF.. Google doesn't give me any information how to fix this..
My question here is: What method should be used to save an openoffice-writer document?
Thanks in advance!
You should look at this similar question which answer covers both MSWord and OOWriter (by the way, creating a Word file could be the easiest to be read with OpenOffice).
How can I create a Word document using Python?
Alexis
You can create a rtf file with pyrtf or it's variants, and for pdf you can use reportlab. These are libraries for use in python, not to control remotely oo. There are other libraries for other formats.

App Engine with Python: How to convert pdf file into different jpeg images

I'm using Google App Engine with Python.
I would like to know how to convert a pdf file into different jpeg images (one for each page). Is it possible?
I found an opensource pdf library: reportlab but it looks like they don't have such a feature in their API. Am I wrong?
Thanks in advance
You want a library called PythonMagick, which can be found here.

Categories

Resources