-
Notifications
You must be signed in to change notification settings - Fork 253
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
Bad PDF layout #72
Comments
I think this can help you: https://github.com/mermaid-js/mermaid-cli/releases/tag/8.8.0. Here we introduced an option to fit the diagram into PDF: --pdfFit Please, let me know if that helps. |
Ok, I'll definitively look into that, currently I used miktex's pdfcrop that do the job quite well (like doing a 'standalone' document) but it requires an extra step in my tex package. And perl as a dependency. |
@Kochise : can we close this one? --pdfFit solves the pdf layout problem. SVG output is corrupt bacause of the upstream dependency (not something we can fix in the CLI project). |
I just tested, it's all ok, thanks a many :) |
Hi, reopening the issue, I updated mermaid and despite the Btw, I checked the |
Hi, Current version: 8.9.0 Here is an example:
I realized that it scales with the amount of text. |
Hi both @Kochise and @wiesener, it might be worth trying out mermaid-cli v9.1.7. It contains the latest changes from Mermad v9.1.7 (PR mermaid-js/mermaid#3364), and it has removed some white space at the top/bottom for some graphs, for example: It looks like the |
Will definitively check into that asap. |
@Kochise do you have an update on the case? |
Closing based on the comments above. You are welcome to reopen if disagree. |
/nvm>npx mmdc -V
9.1.7 /nvm>npx mmdc -i state.mmd -o state.svg
Generating single mermaid chart /nvm>npx mmdc -i state.mmd -o state.pdf
Generating single mermaid chart /nvm>npx mmdc -i state.mmd -o state_fit.pdf --pdfFit
Generating single mermaid chart Seems Ok-ish, still a bit some 'fat' around the graph using "--pdfFit" though... |
Awesome! I don't think we can further get rid of the 'fat' completely (at least not without using some extra libraries), since it's built into the SVG generated by If you're using LaTeX, I'd recommend trying something like https://www.ctan.org/pkg/pdfcrop (often installed by default with LaTeX) to trim the extra whitespace. |
As mentioned here : mermaid-js/mermaid#341
Since the SVG output is still corrupt as of '8.8.2-beta.8', I tried the PDF way, just to see, and while the output is correct, the layout is wrong, hence I cannot import the PDF instead of the SVG (LaTeX destination).
expected : generate a SVG file from mermaid to get imported as a figure in LaTeX
actual : SVG works in browser, not in Inkscape, hence translation for LaTeX outputs something weird
temporary fix : use PDF output
expected : figure to fill the page, or page shrink around the picture
actual : PDF layout is wrong, letter size with figure in top left corner
See attached file.
state.pdf
The text was updated successfully, but these errors were encountered: