Print Page | Close Window

Can't write formatted text to PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3908
Printed Date: 19 Apr 24 at 7:16AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Can't write formatted text to PDF
Posted By: Cefeg
Subject: Can't write formatted text to PDF
Date Posted: 31 Mar 21 at 2:22AM
Using VB.Net, QuickPDF Library v16 DLL.  Objective is to convert a one page text file formatted mostly as separate lines without word wrap to a PDF.  Looking at forum and KB I could not code for this requirement.

After reading the text file with StreamReader (either ReadLine and appending vbCRLF or reading the text file into one string) the following code gives me a PDF with only one line across the top with no line breaks.
  qp.SetOrigin(1)                   ' origin at top left
  qp.DrawText(30, 50, sText)  ' write text after top left margin
  qp.SaveToFile(sPDFname)    ' save to pdf document 

Same result using: 
  Dim hFile = fs.SafeFileHandle.DangerousGetHandle()
  qp.DASaveAsFile(hFile, sPDFname)    where hFile is the file handle to the formatted text file.

In all cases the CR + LF do not work.

How can I effectively convert a plain formatted text file to PDF so it appears similar?




Replies:
Posted By: Ingo
Date Posted: 31 Mar 21 at 10:50PM
Hi,

i've done a quick search in the online reference...
DrawMultiLineText should feed your needs:
https://www.debenu.com/docs/pdf_library_reference/DrawMultiLineText.php



-------------
Cheers,
Ingo



Posted By: cefegdev
Date Posted: 01 Apr 21 at 12:18AM
Smile  
Ingo,

Thanks for that. It works perfectly.

Clark



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk