F
F
FaNaT2021-08-25 04:23:29
HTML
FaNaT, 2021-08-25 04:23:29

How to convert html to pdf, epub or fb2?

Hello. I wrote a small parser for myself that collects the text of an online book. But he saves it in html so that styles and stuff do not fly off. How can I convert html to pdf, epub or fb2 so that at least images are displayed in already generated documents? It will work as a library option for C #, or just a PC program / browser extension. Through online services and caliber, only text can be retrieved.

Through "print - save as pdf..." in the browser it is possible to save with images. But the size of the output pdf file is huge just because of the images themselves. Therefore, maybe there is a tool that can compress pictures as well? Doing it manually will not be very convenient.

The html document has the simplest possible structure

<div>
<p>....</p>
<p>....</p>
<p>....</p>
<img data-src="ссылка на изображение на сервере сайта">
<p>....</p>
<p>....</p>
</div>


Thank you very much in advance for your help)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
1
12rbah, 2021-08-25
@12rbah

You can try to limit the size of the image through the width height (for example, to scale (400/600), you can see the answers for such a request (c# pdf scale image), there are small features if you decide to resize the image already in the finished document and not html.

M
Maxim, 2021-08-25
@ikfah012

I once did something similar.
I used this library for php: guide
A went through the images with mass resizing and converting to webp using FastStone Photo Resizer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question