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

GeneratePdf(), returns an empty PdfDocument #202

Open
Sercos10 opened this issue Jun 7, 2023 · 1 comment
Open

GeneratePdf(), returns an empty PdfDocument #202

Sercos10 opened this issue Jun 7, 2023 · 1 comment

Comments

@Sercos10
Copy link

Sercos10 commented Jun 7, 2023

Hello i'm trying to generate a pdf via html string passed by parameter, my problem is that when i want to save the PdfDocument returned by the function, it doesn't have any pages or content (image of the debug is attached), here are the versions that i use:

Versions
HtmlRenderer.Core: 1.5.1-beta1
HtmlRenderer.PdfSharp: 1.5.1-beta1
PdfSharp: 1.51.5185-beta

Here is the code of my function:
var config = new PdfGenerateConfig();
config.PageOrientation = PageOrientation.Portrait;
config.PageSize= PageSize.A4;
PdfSharp.Pdf.PdfDocument pdf = PdfGenerator.GeneratePdf(html, config);
pdf.Save(path);

image

image

And because it has no Pages and no content, i can't save it because it throws me the exception: 'Cannot save a PDF document with no pages'

Thank you in advantage :)

@rblanca
Copy link

rblanca commented Dec 9, 2023

you have to combine it with PdfSharp latest version and use this HtmlRendererCoreNet7.PdfSharp

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

No branches or pull requests

2 participants