DavBfr / dart_pdf

Pdf creation module for dart/flutter
https://pub.dev/packages/pdf
Apache License 2.0
1.42k stars 634 forks source link

Directly Embed LaTeX in PDF #1502

Closed bastulli closed 1 year ago

bastulli commented 1 year ago

Is your feature request related to a problem? Please describe. Yes, it is related to the problem of rendering LaTeX in the PDFs generated using the Flutter PDF library. Currently, the implementation of LaTeX rendering in PDF involves converting LaTeX equations to images and then embedding these images in the PDF. This process may compromise the quality and sharpness of the rendered LaTeX, especially when zoomed in, and increases the complexity and computational requirements of PDF generation by involving image generation, storage, and retrieval.

Describe the solution you'd like I'd like to propose a feature that enables direct rendering of LaTeX equations in the PDF without converting them into images. This feature will preserve the clarity of the LaTeX renders, offer scalable vector outputs in the PDF, and reduce the complexity by eliminating the need for image processing and embedding.

A potential solution could involve:

An integrated LaTeX renderer within the PDF library. A method to parse and directly embed LaTeX code in the PDF, rendering it as scalable vector graphics or text, maintaining the high quality at any zoom level.

Describe alternatives you've considered

Additional context The current process involves:

  1. Rendering LaTeX equations as images.
  2. Embedding these images in the PDF.

While this approach works, it introduces several challenges and limitations:

Enhanced quality and clarity of LaTeX renders in the PDF. Simplified and more efficient PDF generation workflows. Potentially smaller PDF file sizes by avoiding embedding images. This feature would be incredibly valuable for applications and platforms dealing with scientific, mathematical, or technical content, enhancing the quality and user experience of generated PDFs.

User Story As a flutter developer creating PDF documents, I want to directly render LaTeX in PDF documents without converting to images, So that I can ensure high-quality, scalable, and efficient LaTeX representation in generated PDFs.

Acceptance Criteria Given a piece of LaTeX code, When I add it to a PDF document, Then the LaTeX should be rendered directly within the PDF without being converted to an image.

Other needs/tasks: Investigate potential engines or libraries for LaTeX rendering. I like (flutter_math_fork)

DavBfr commented 1 year ago

Sounds nice. The PDF library already comes with SVG support. Maybe a LaTeX to SVG path to PDF would simplify.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] commented 1 year ago

Closing this stale issue because it has no activity.