-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of embedded .emf files #16
Comments
We don’t handle that yet. I already asked @mkraetke to add an HTML report output for docx2tex that contains the messages that emerge from docx2hub. These types of embeddings should be reported there (and removed or replaced with a dummy, as you suggested). |
I would consider this as an enhancement as docx2tex is not intended to convert images. I would suggest that an image processing is done outside of docx2tex. An XProc wrapper for ImageMagick or libwmf would be a bad solution since these tools are not capable of handling clippings, borders etc properly. In this sense I would add htmlreports accompanied with Schematron rules in a later release. |
I think C-REX uses Inkscape for the EMF conversions to SVG with PNG as fallback..doing a reasonably good job. |
Convert images using visioconnor: kevin2059@163.com import os
import sys
import win32com.client
from os.path import abspath
visio = win32com.client.Dispatch("Visio.InvisibleApp")
folder=abspath(sys.argv[1])
for oldfilename in os.listdir(folder):
if oldfilename.endswith(".emf"):
f=abspath(folder+'\\'+oldfilename)
doc = visio.Documents.Open(f)
visio.ActivePage.ResizeToFitContents()#Set the border size according to the content
doc.ExportAsFixedFormat(1, '{}.pdf'.format(f), 0,0,0,0,False,False,False,False)#Remove the black border
visio.ActiveDocument.Saved=True
visio.ActiveDocument.Close()
visio.Quit() |
@pbpf In the environment that transpect typically runs in, there’s no Visio (or any other Microsoft software) installed. |
We have been using |
Thank you for this suggestion. I had rather frustrating results with ImageMagick. However, I'm looking for an EMF converter which is based on Java in order to wrap it as XProc extension step so docx2tex does not rely on pre-installed software (besides Java of course). |
inkscape 1.01 works, can we use it?
|
Thanks you for the suggestion. Unfortunately, we don't know the install path and it may vary between operating systems. I would rather stick to a Java library which is capable of converting EMF properly. However, I'll have a look how inkscape handles EMF files. |
We have DOCX files where the authors often embed Powerpoint files.
This case is not handler properly.
Ideally .emf files would converted to proper SVGs or PNGs.
If this is not possible they should be removed and not carried forward the LaTeX output
Perhaps removed image could be replace with a placeholder or a warning message.
The text was updated successfully, but these errors were encountered: