0% found this document useful (0 votes)
2 views1 page

Python Code PDF-2

The document contains Python code that utilizes the WeasyPrint library to convert HTML content into a PDF format. It defines the HTML structure and styling for a document titled 'History Notes'. The code specifies page size, margins, and font settings before generating the PDF output.

Uploaded by

majumdarmihir15
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Python Code PDF-2

The document contains Python code that utilizes the WeasyPrint library to convert HTML content into a PDF format. It defines the HTML structure and styling for a document titled 'History Notes'. The code specifies page size, margins, and font settings before generating the PDF output.

Uploaded by

majumdarmihir15
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Code PDF

from weasyprint import HTML

# HTML content for the History Notes


html_content = """
<!DOCTYPE html>
<html lang="bn">
<head>
<meta charset="UTF-8">
<style>
@page {
size: A4;
margin: 20mm;
background-color: #ffffff;
}
body {
font-family: 'Times New Roman', serif;
line-height: 1.7;
color: #000000;
margin: 0;
padding: 0;
}
...
HTML(string=html_content).write_pdf(output_pdf_path)

You might also like