Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Textimport
  FAQ FAQ  Forum Search   Register Register  Login Login

Textimport

 Post Reply Post Reply
Author
Message
KHentschel View Drop Down
Beginner
Beginner


Joined: 26 Feb 06
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote KHentschel Quote  Post ReplyReply Direct Link To This Post Topic: Textimport
    Posted: 24 Jun 08 at 8:21AM
Hello,
 
i try to convert a Textfile to a PDF File. I do this with DrawTextBox or FitTextBox with a AddStandardFont(0). Everything runs fine, the PDF is created. But how can i keep the formating of Spaces and Tabs?
 
The Textfile looks like this:
 
|***********************************************|
|  Satzart                 :          |         |
|  Versions-Nummer         :          |         |
|  Kunden-Nummer           :          |         |
|  Lieferanten-Nummer      :          |         |
|  Übertragungs-Nummer ALT :          |         |
|  Übertragungs-Nummer NEU :          |         |
|  Übertragungsdatum       :          |         |
|  Ust.IdNr. Empfänger     :          |         |
|  Ust.IdNr. Lieferant     :          |         |
*-----------------------------------------------*
 
the created PDF File looks like this:
 
|***********************************************|
|  Satzart                 :          |         |
|  Versions-Nummer         :          |         |
|  Kunden-Nummer           :        |  |
|  Lieferanten-Nummer      :        |    |
|  Übertragungs-Nummer ALT :          |         |
|  Übertragungs-Nummer NEU :        |  |
|  Übertragungsdatum       :        |         |
|  Ust.IdNr. Empfänger     :        |  |
|  Ust.IdNr. Lieferant     :        |  |
*-----------------------------------------------*
 
i think the DrawText looses the Tabs?!
 
Could anyone can help me in this? Is there a better Function than DrawTextBox or FitTextBox
 
Best regards
 
Klaus Hentschel
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jun 08 at 9:22AM
Hi!

It's the correct font (courier) but it's not enough to add the font.
SelectFont is needed i think.
Hope this helps.

Best regards,
Ingo
Back to Top
KHentschel View Drop Down
Beginner
Beginner


Joined: 26 Feb 06
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote KHentschel Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jun 08 at 9:34AM

Hi Ingo,

i add the SelectFont into my Programm and also this do not keep the formating. The output was also before (without SelectFont) in Courier.

Thanks
 
Klaus
Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jun 08 at 12:24PM
Klaus, I am trying to do the same thing. My program will look for text files in a folder and convert them to pdfs. I can't seem to get it to work. Could you post a code snipit showing how you convert the text file and save it?
 
Thanks
Wayne
 
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jun 08 at 6:54PM
You can set string (with positions) by string ...
But that's not really a fast way ;-)
DrawHTMLText or DrawHTMLTextBox can be worth to try ... I'm out of office - so only few tips ;-)

Good luck,
Ingo
Back to Top
KHentschel View Drop Down
Beginner
Beginner


Joined: 26 Feb 06
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote KHentschel Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jun 08 at 3:35AM
Hello Wayne,
 
here is the example. I develop with MS Visual FoxPro
 
lcText = FILETOSTR(GETFILE())
loPDF = CREATEOBJECT("iSED.QuickPDF")
loPDF.UnlockKey('your Code')
lnWidth = FLOOR(loPDF.PAGEWIDTH())
lnHeight = FLOOR(loPDF.PAGEHEIGHT())
loPDF.SetPageSize('A4 Landscape')
lnFontID = loPDF.AddStandardFont(0)
loPDF.SelectFont(lnFontID)
loPDF.FitTextBox(10,lnHeight,lnWidth,lnHeight,lcText,0)
loPDF.SaveToFile(PUTFILE())
RELEASE loPDF
Where is your Problem?
 
Best regards
 
Klaus
Back to Top
KHentschel View Drop Down
Beginner
Beginner


Joined: 26 Feb 06
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote KHentschel Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jun 08 at 4:03AM

Hi Ingo,

i change the FitTextBox into DrawHTMLTextBox. Now i can not see any Text. What i want is to put plain Text into a PDF, not HTML Text.
 
Best regards
 
Klaus
Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 30 Jun 08 at 12:23PM
Well one thing to consider if trying to use a horizonal tab character is "where do you specify how many spaces equals one HT?" Unless there is a property for that then I feel like you will need to manually convert the HT to spaces. This is more of a conceptual things for example. At my shop we have several programmers and our code editor used to insert HT into the code but we quickly realized that different programmers had configured their editor to translate a HT into different number of spaces so after one person wrote some code nothing would line up right for another programmer viewing it.
 
Once you get around the HT -> Spaces conversion, then you may experience what I am currently experiencing which is when I draw text to a page, if the text has more than one consecutive space it will remove all but one. So "abc      xyz" gets converted to "abc xyz". I know I encountered this same thing when converting text to XML and back using an XML DOM parser and determined that is the standard in xml conversion so I am assuming the draw text is being ran through some type of conversion and I wonder if I have to URL encode the text first?
I know this will not help much but I can see we are somewhat in the same boat which is trying to figure out how to simply draw text to a PDF and have it match our expectations.
 
wayne
 
Back to Top
KHentschel View Drop Down
Beginner
Beginner


Joined: 26 Feb 06
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote KHentschel Quote  Post ReplyReply Direct Link To This Post Posted: 01 Jul 08 at 6:34AM
yes Wayne, "we sit in the same boat" :-)
 
as i told you i program with Visual Foxpro. I have to do the following also in my program:
 
- take a plain Textfile with multiple pages (Textfiles have no PageBreak)
- make single Pages
- convert the whole dokument into PDF File
- convert the last Page into PDF File
 
Ok, i have done it know completly in FoxPro. The Spaces are accurate and i have single Pages.
 
Best regards
 
Klaus
Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 01 Jul 08 at 12:00PM
I finally got mine working as well so for the sake of other readers...
I found that the method FitTextBox will replace multiple spaces with a single space but the method DrawText does not. So as it turned out I had to Draw each line of each page separtely.
 
Now I have another stange thing, one of my Text files works out to be around 3,500 pages. My logic was taking about 5 minutes to convert so I found what was taking so long and now I will post another message to try to get an answer. What I found was if I remove a single line of code which was PDF.SetPageSize('Letter') then it only took about 10 seconds to create the PDF. I call SetPageSize() right after each time I call SelectPage().
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store