Dynamic Height / Elements bottom margin

24 March, 2025 12:16:01
fyxed
Topics: 1
Messages: 3
Hello everyone,

I’ve been configuring the plugin, and I think I’m very close to achieving my goal: exporting blog posts (CPT) in a clean and well-structured way. These posts are built using the default WordPress Block Editor.

I started with a template for mobile, and if everything goes well, I’ll upgrade my license to create another template for desktop.

Questions:
• Is there a way to adjust the bottom spacing for <p> tags and wp-block-image elements rendered in the PDF? The default spacing is quite large, and I’d like to reduce it slightly.

• Is it possible to create a title with truly automatic height? The title can be very long, and currently, in the template, I’m using [e2pdf-wp key="post_title"]. I set “Dynamic Height” to true, but it still requires a value for “height,” and I’m not sure what to enter. See attach-1.png please.


• Does my template structure make sense? See attach-2.png please.
I just want to print:
[Page 1]
post-title
post-featured-image
[/Page 1]
[Page 2]
post-content (Set in multipage)
[/Page 2]

[ATTACHED SCREENSHOT 1]

Thanks in advance for your help!
24 March, 2025 14:19:45
E2Pdf
Support
Topics: 7
Messages: 3438
Hello,

Unfortunately, "Dynamic Height" can only make the block smaller, not larger. E2Pdf uses "static" element positions. As an alternative, you can replace the "HTML" object containing the title with a "textarea" and enable "Auto Font Size" in the "Properties" of the "textarea." This way, the font size will automatically reduce to fit within the "textarea" if it overflows.

Regarding the margins of the "p" tags - yes, it is likely possible to adjust them by adding custom CSS to the "HTML" object. However, to provide a more precise solution, we need to see the HTML page source. If possible, could you provide us with the URL of the post you are trying to print as a PDF so we can examine the generated source? You can mark the message as "private" so only support can see it.
We would really appreciate your feedback at WordPress.org!
24 March, 2025 17:03:37
E2Pdf
Support
Topics: 7
Messages: 3438
From your screenshots, we see that it should not create additional spacing. Could you please check if 'New Lines to BR' is NOT checked in the properties of the HTML object where [e2pdf-wp key="post_content"] is used?
We would really appreciate your feedback at WordPress.org!
25 March, 2025 07:25:26
fyxed
Topics: 1
Messages: 3
Oh, perfect! That was the problem.
Excellent, thank you so much!

I’ve already given the plugin a 5-star rating on WP.org.

One last question (I think!):
Now I need to add some space between certain elements, like images or some paragraphs. Is there any way to add spacing to specific elements? Adding a padding-bottom css class maybe?

I tried this, but it doesn’t seem to work.

CSS:
.pdf-content .wp-block-image { padding-bottom: 30px; }
.pdf-content img { padding-bottom: 30px; }

Value:
<div class="pdf-content">[e2pdf-wp key="post_content"]</div>
25 March, 2025 07:53:50
E2Pdf
Support
Topics: 7
Messages: 3438
Thank you for you outstanding review.

It should be used the "margin-bottom" CSS, for example:

.pdf-content .wp-block-image {
margin-bottom: 30px;
}

p {
margin-bottom: 10px;
}
We would really appreciate your feedback at WordPress.org!