Lines are broken outside of A4 format border in case no spaces are found a line of text
Code:
>
private static byte[] GenPdfFromHtmlString(string htmlString, PdfModel pdfModel)
{
HtmlLoadOptions objLoadOptions = new HtmlLoadOptions
{
PageInfo =
{
IsLandscape = false,
Width = PageSize.A4.Width,
Height = PageSize.A4.Height,
Margin = new MarginInfo(40, 100, 40, 100)
},
IsEmbedFonts = true,
PageLayoutOption = HtmlPageLayoutOption.None
};
MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(htmlString));
Document pdfDocument = new Document(memoryStream, objLoadOptions);
memoryStream.Dispose();using (MemoryStream outputStream = new MemoryStream()) { pdfDocument.Save(outputStream, SaveFormat.Pdf); return outputStream.ToArray(); } }
Html:
>
<html> <head> <title>htmltopdftest</title> </head> <body> <p> Paragraph11Paragraph12Paragraph13Paragraph14Paragraph15Paragraph16Paragraph17Paragraph18Paragraph19Paragraph110Paragraph111Paragraph112Paragraph113Paragraph114 Paragraph21Paragraph22Paragraph23Paragraph24Paragraph25Paragraph26Paragraph27Paragraph28Paragraph29Paragraph210Paragraph211Paragraph212Paragraph213Paragraph214 Paragraph3Paragraph3 Paragraph4Paragraph1Paragraph4 </p> </div> </body> </html>
image.png (31.8 KB)