'Converting original format of text processing file into PDF - using Python
I have the following python code for converting text to pdf. Instead of having fixed font size, alignment etc., I want to copy all the lines from the text file with original format(from text file). Is there a way to get this logic using FPDF or any other method using python program?
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size = 12)
f = open("D:\hello.txt", "r")
for x in f:
pdf.cell(200, 10, txt = x, ln = 1, align = 'L')
pdf.output("D:\hello.pdf")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
