[ 
https://issues.apache.org/jira/browse/PDFBOX-1807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15159544#comment-15159544
 ] 

Frodo Looijaard commented on PDFBOX-1807:
-----------------------------------------

A tab is not expanded to 8 spaces, a tab is expanded so that the next character 
starts in column number (n * 8) + 1 for the lowest n possible.
As said, this assumes a non-proportional font. For a proportional font, this 
will just insert the same number of spaces; things will line out for tabs at 
the start of a line, but not for tabs in the middle. Getting it right for 
proportional fonts is not trivial, as lines in the source document could be 
much longer than in the PDF document (text is reflowed), which means that tabs 
could end up anywhere.
So, for non-proportional fonts, this will make tabs line up the text like in 
the source text document; for proportional fonts, it will at least stop this 
tool from just balking out with an exception.
Note that 8 spaces to a tab is common, but of course there are other 
conventions. Again, it seems to me better to have non-perfect output than no 
output at all. Using a command line switch to set the number of spaces to a tab 
would of course be possible. 

> TextToPDF strips leading spaces from input file
> -----------------------------------------------
>
>                 Key: PDFBOX-1807
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1807
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.8.3
>         Environment: Win7 64 bit
>            Reporter: Mark Mitchell
>            Priority: Minor
>             Fix For: 3.0.0
>
>         Attachments: pdfbox-2.0.0-RC3-tabs_spaces.diff
>
>
> When using the TextToPDF utility on a text file that has spaces in the front 
> for formatting purposes, the leading spaces on the line are being stripped 
> causing the report to no longer looks like it did in the PDF.  
> Was this the intended result?  Is there a way to turn off the stripping of 
> the spaces?  If not, can it be added?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to