Skip to content
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

Resize images #18

Open
tmaier opened this issue May 28, 2017 · 3 comments
Open

Resize images #18

tmaier opened this issue May 28, 2017 · 3 comments

Comments

@tmaier
Copy link

tmaier commented May 28, 2017

I have a markdown file with an image embedded. The image is quite large.
The output file embeds the image at original size. This means the image is outside of the visible area.

It would be great if md2pdf would resize the image to fit into the print area

@jmaupetit
Copy link
Owner

jmaupetit commented May 29, 2017

Thanks for this report. A CSS rule should be missing. Did you use the --css /path/to.css option?

@tmaier
Copy link
Author

tmaier commented May 30, 2017

No I haven't. I used it with the docker image and did not have a css handy.

@jmaupetit jmaupetit modified the milestone: Release 0.5 May 30, 2017
@seetimee
Copy link

seetimee commented Oct 14, 2024

example style.css

img {
    display: block;
    margin: 0 auto; /* 将图片居中 */
    max-width: 100%; /* 使图片自适应 PDF 页面的宽度 */
    height: auto;    /* 保持图片的纵横比 */
}

p {
    text-align: justify; /* 让文本对齐 */
    margin-top: 20px;    /* 图片与上方文本的距离 */
    margin-bottom: 20px; /* 图片与下方文本的距离 */
    vertical-align: top;  /* 保证文字和图片的上下对齐 */
}
body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    font-size: 16px;       /* 字体大小,可以根据需要调整 */
    line-height: 1;      /* 行高,设置合适的行距 */
    /* color: #4F602B;         文字颜色,可以调整为图片中类似的颜色 */
    /* background-color: #F5FDEB;  背景颜色,类似淡绿色 */
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants