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

HTML Table not well drawn #28

Open
hafedh-trimeche opened this issue Feb 10, 2019 · 0 comments
Open

HTML Table not well drawn #28

hafedh-trimeche opened this issue Feb 10, 2019 · 0 comments

Comments

@hafedh-trimeche
Copy link

hafedh-trimeche commented Feb 10, 2019

Hello,

I wrote this procedure to convert HTML to PDF.
But the Table is not well drawn.
HTMLViewer is used for rendering: https://github.com/BerndGabriel/HtmlViewer

procedure THTMLToXForm.HTMLViewerSynPDFClick(Sender: TObject);

var
Size : TSize;
Viewer : THtmlViewer;
pdfForm : TForm;
pdf : TPdfDocumentGDI;
begin
pdf := TPdfDocumentGDI.Create;
pdfForm := TForm.Create(nil);
Viewer := THtmlViewer.Create(pdfForm);
Viewer.Parent := pdfForm;
Viewer.DefBackground := clWhite;
Viewer.LoadFromFile(htmlFile);
Size.cx := Round(HTMLWidthFromViewPort(viewer.Text)*pdf.ScreenLogPixels/25.4);
Size := viewer.FullDisplaySize(Size.cx);
pdf.AddPage;
pdf.DefaultPageWidth := Size.cx;
pdf.DefaultPageHeight := Size.cy;
Viewer.Draw(pdf.VCLCanvas,0,Size.cx,Size.cx,Size.cy);
pdf.SaveToFile(ChangeFileExt(htmlFile,'-HTML-To-SYNPDF.pdf'));
pdf.Free;
pdfForm.Free;
end;

Reporter-HTML-To-SYNPDF.pdf

Reporter.txt

Best regards.

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

1 participant