You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2013/10/23 11:35:42 UTC

[jira] [Commented] (PDFBOX-1753) The font gets gibbrish when adding a line of text to an existing PDF with a table

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

Andreas Lehmkühler commented on PDFBOX-1753:
--------------------------------------------

MLKs explanation is totally correct and I will fix this soon

But to speak frankly it makes me sad to see someone (MLK) who obviously knows a lot about pdfs and PDFBox, helping others with codesamples and fixes/workarounds but doesn't participate in the official PDFBox community here at Apache :-( Maybe we should try to contact him/her ...

> The font gets gibbrish when adding a line of text to an existing PDF with a table
> ---------------------------------------------------------------------------------
>
>                 Key: PDFBOX-1753
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1753
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.2
>         Environment: Windows 7
>            Reporter: Anita Kulkarni
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
> When trying to add a line to the existing PDF document with a table the table headers appear gibberish. 
>  the table header used to be PMITS Asset ID and after adding the header it reads as: 3 0 , 7 6 $ V V H W. some gibberish characters. Here is my code:
>     // the document
>     PDDocument doc = null;
>     try
>     {
>         doc = PDDocument.load( file );
>         List allPages = doc.getDocumentCatalog().getAllPages();
>         //PDFont font = PDType1Font.HELVETICA_BOLD;
>         for( int i=0; i<allPages.size(); i++ )
>         {
>             PDPage page = (PDPage)allPages.get( i );
>             PDRectangle pageSize = page.findMediaBox();
>             PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true,true);
>             PDFont font = PDType1Font.TIMES_ROMAN;
>             float fontSize = 15.0f;
>             contentStream.beginText();
>             // set font and font size
>             contentStream.setFont( font, fontSize);
>             contentStream.moveTextPositionByAmount(700, 1150);
>             contentStream.drawString( message);
>             contentStream.endText();
>             //contentStream.
>             contentStream.close();}
>         doc.save( outfile );
>     }
>     finally
>     {
>         if( doc != null )
>         {
>             doc.close();
>         }
>     }
> }
> Stack overflow has a lot of discussion about this issue and explained by user MLK
> http://stackoverflow.com/questions/19322553/adding-header-to-existing-pdf-file-using-pdfbox
>    I am not sure how to attache the test PDF to this issue.



--
This message was sent by Atlassian JIRA
(v6.1#6144)