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

Tilman Hausherr commented on PDFBOX-3805:
-----------------------------------------

I know that PDFBOX-1807 is not solving the issue. I mentioned it to explain the 
problem that there is no clear solution about what to do with tabs.

Workarounds could be to swallow the tabs, or to replace them with something. 
This should be done in pre-processing. For example, replacing the tabs with a 
space would be like this:
{code}
InputStream is = ....
OutputStream os = ....
int by;
while ((by = is.read()) != -1)
{
    if (by == 9)
         os.write(32);
    else
         os.write(by);
}
is.close();
os.close();
{code}


> Exception while reading text file using createPDFFromText of apache pdfbox 
> 2.0.6 version
> ----------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3805
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3805
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.6
>         Environment: Windows 7, java 1.8 version
>            Reporter: Varun Joshi
>            Priority: Blocker
>         Attachments: PDFToText.java, sampleTextRead2.txt
>
>
> While using createPDFFromText() of TextToPDF, throwing exception when tab 
> comes while reading text file.  Attached is the java(PDFToText.java) sample 
> program which I am executing and sample data text file (sampleTextRead2.txt) 
> which is being read. 
> Below is the exception while executing :-
> Exception in thread "main" java.lang.IllegalArgumentException: U+0009 
> ('controlHT') is not available in this font Helvetica encoding: 
> WinAnsiEncoding
>       at 
> org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:425)
>       at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:323)
>       at org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:352)
>       at 
> org.apache.pdfbox.tools.TextToPDF.createPDFFromText(TextToPDF.java:197)
>       at 
> org.apache.pdfbox.tools.TextToPDF.createPDFFromText(TextToPDF.java:98)
>       at PDFStripper.PDFToText.main(PDFToText.java:23)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to