Hi Mark, thank you for your reply. I also think that there is something
wrong with the font. Could you please tell me what exactly is wrong with the
font? Also, is there a way to fix the font using some sort of font editing
software?
Sincerely,
Mir
On Wed, Feb 9, 2011 at 2:43 PM, Mark Storer <[email protected]> wrote:
> My first instinct is to blame the font. I selected the text in the PDF
> you attached and a fair portion of the loop of the 'd' is outside the
> selection's box... which isn't a good sign. OTOH It's hard to tell for sure
> but it looks like the bottom of the Y would fit into the selection's box,
> and that box drops below the bottom of the cell.
>
> I'm still inclined to blame the font.
>
> --Mark Storer
> Senior Software Engineer
> Cardiff.com
>
> import legalese.Disclaimer;
> Disclaimer<Cardiff> DisCard = null;
>
>
>
> ------------------------------
> *From:* Mir Tanvir Hossain [mailto:[email protected]]
> *Sent:* Wednesday, February 09, 2011 11:42 AM
> *To:* [email protected]
> *Subject:* [iText-questions] iText Text Chopping Issue with Embedded Fonts
>
> Hello everyone, this is my first email to this list. I am trying to use
> iText to create pdfs with simple text using different fonts. I am having an
> issue with the text being chopped off when I try to align the text based on
> ascender and descender. I have attached the pdf in question with this email
> so that everyone can take a look. I am using the following function to
> create the pdf. If anyone please help me with suggestions on how to prevent
> the text chopping issue, I'd really appreciate that.
>
> public void createPdf() throws DocumentException, IOException {
> FontFactory.registerDirectory("/var/fonts/", true);
>
> String text = "yfd";
> float width = 100;
> float height = 50;
> float fontSize = 20;
> String fontName = "SquarePegROB";
>
> Font font = FontFactory.getFont(fontName, "", BaseFont.EMBEDDED,
> fontSize, 0, new BaseColor(new Color(0, 0, 0)));
>
> Paragraph contentParagraph = new Paragraph(text, font);
> contentParagraph.setLeading(fontSize * 1.2f);
>
> Document doc = new Document(new Rectangle(width, height));
> doc.setMargins(0, 0, 0, 0);
>
> FileOutputStream fos = new FileOutputStream( new
> File("/home/mhossain/itext/pdfs/pdftest.pdf"));
> PdfWriter.getInstance(doc, fos);
>
> PdfPTable table = new PdfPTable(1);
> table.setWidthPercentage(100);
> table.setTotalWidth(width);
> table.setLockedWidth(true);
> table.setSpacingBefore(0);
> table.setSpacingAfter(0);
>
> PdfPCell cell = new PdfPCell(contentParagraph);
> cell.setColspan(1);
> cell.setFixedHeight(height);
> cell.setHorizontalAlignment(Element.ALIGN_LEFT);
> cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
> cell.setUseAscender(true);
> cell.setUseDescender(true);
> cell.setPadding(0);
>
> table.addCell(cell);
>
> doc.open();
> doc.add(table);
> doc.close();
>
> fos.close();
> }
>
> Sincerely,
> Mir
>
>
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php