BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
Hello,
I would like to know if there is a way to show formatted LaTex equations in a PdfDocument?
Previously, I had been creating a word document and then converting it to PDF, however the conversion is quite slow when using the following code:
using (DocToPDFConverter converter = new())
{
converter.Settings = new DocToPDFConverterSettings() { ExportBookmarks = ExportBookmarkType.Bookmarks };
using (PdfDocument pdfDocument = converter.ConvertToPDF(document))
{
pdfDocument.Save(path);
}
};
Because that is taking too long, I am trying to create a PdfDocument directly but I need to be able to see the formatted LaTex equation. If instead there is a way to speed up that process, I would be willing to
Thanks.
Hi Natalie,
We have created a Word document with a LaTeX equation and converted it to PDF. The overall generation took 2 seconds on our end. Internally, DocIO converts the LaTeX string to a Document Object Model (DOM) and maintains it as a Word document object model. During the Word to PDF conversion, DocIO measures each content element to position them using its own layout techniques. As a result, this process can take a considerable amount of time when converting equations from the Word document to PDF. Please refer to the attached sample.
If you feel that the process and conversion are taking too long, please share the following details:
With this information, we can check the feasibility of improving performance for your scenario.
Regards,
Dharanya.
Is it possible to add the LaTex equation directly to PdfDocument? Possibly by creating an image file? or by converting it to OfficeMath? I am considering creating the PdfDocument directly rather than creating the wordDocument and converting it to PDF because that process take a long time.
Natalie,
Regarding “Is it possible to add the LaTex equation directly to PdfDocument?
Possibly by creating an image file? or by converting it to OfficeMath?”:
Unfortunately, we do not offer direct support for converting LaTeX formulas
into PDF documents. The process involves first converting the LaTeX into a Word
document and then creating a PDF from that Word document. During this
conversion, LaTeX formulas are processed into strings, which are then rendered
into the PDF document. Therefore, a direct conversion is not possible, and we
are unable to fulfill your request at this time.
So, kindly share the following details:
With this information, we will check the
possibility of reducing the time required for the updating TOC.
Regards,
Dharanya.
To insert LaTeX into a PDF, you have several options depending on the tools you’re using and the outcome you want. Here are a few common methods:
If you’re creating the entire document in LaTeX, you can generate a PDF directly by using software like Overleaf, TeXShop, or MiKTeX. Write your LaTeX code (.tex file) with any text, math, and formatting, then compile it to a PDF output:
latex\documentclass{article} \usepackage{amsmath} \begin{document} Here is an equation: \begin{equation} E = mc^2 \end{equation} \end{document}
If you already have a PDF and want to add LaTeX equations to it, consider these steps:
On Overleaf, you can import your existing PDF into a new LaTeX project and use pdfpages
to include it. Then, you can overlay additional LaTeX content.
latex\documentclass{article} \usepackage{pdfpages} \begin{document} \includepdf[pages=1]{yourfile.pdf} % Insert the existing PDF page Here is an added equation: \[ E = mc^2 \] \end{document}
Some PDF editors (e.g., Inkscape or certain LaTeX-compatible editors) let you add LaTeX directly. For example, Inkscape has LaTeX plugin support for adding equations directly into PDFs.
These methods allow you to integrate LaTeX equations and text into PDFs either by creating a new document or by adding to an existing one.
Natalie,
We will analyze the feasibility of inserting LaTeX
equations into PDF documents and will provide you with more details within two
days.
Regards,
Dharanya.
Natalie, still we are analyzing the feasibility of inserting LaTeX equations into PDF documents and will provide you with more details within two days.
Natalie,
we have considered your requirement “LaTeX (MathML) equation to Image” in our
existing backlog feature “Provide API to convert the shape as image” which is
used to convert the specific object in the Word document to image. By utilizing
this feature, we can extract and render only the specific equation as an image,
rather than converting the entire Word document, thereby accelerating your
process.
Once this feature is available, you can achieve your requirement like below,
1. Create a Word document with LaTeX.
2. Convert specific LaTeX to Image using DocIO.
3. Insert the converted LaTeX image into PDF document.
At present, we don’t have any immediate plan to implement this feature in our
end. We will let you know once this feature has been implemented.
Please track the status of the feature through the feedback
link.