ArthurHub / ArthurHub/HTML-Renderer

The library ignores position:absolute styling

Abierto
#203 2 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
C#
Estrellas
1.4k
Forks
550
Merge medio
14 d 9 h
PR fusionados (30 d)
1

Descripción

I have HTML code with many elements with style position: absolute. The HTML code looks good in the browser but when I try to convert it to pdf using HtmlRenderer.PdfSharp, I get all the elements in the top left corner. How can I fix this?

Here is my code:
```c#
using PdfSharp;
using PdfSharp.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;

var html = "...";
File.WriteAllBytes("draft.html", Encoding.UTF8.GetBytes(html));
using PdfDocument pdf = PdfGenerator.GeneratePdf(html, PageSize.A4, margin:0);
using var ms = new MemoryStream();
pdf.Save(ms);
File.WriteAllBytes("draft.pdf", ms.ToArray());
return ms.ToArray();
```
The html:
```html

Hello world!


Hello world!1


Hello world!2


Hello world!3

```
Below is how the generated pdf looks like:
![MPt2s](https://github.com/ArthurHub/HTML-Renderer/assets/39989294/2ac154ef-9584-442e-8897-9ef8d9f1d7ed)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.