f



getting character width of monospaced font with pdflib

Hi all,

I'm using an old version of pdflib (2001) under Java, and right now
I'm unable to provide the exact version, sorry.

Is there a way to get the character width of a monospaced font? In
Java I would use something like this:

    Font f = ...;
    Graphics g = ...;
    g.setFont(font);
    FontMetrics fm = g.getFontMetrics();
    int charWidth = fm.charWidth('A');

Is there something equivalent for pdflib??? Can anybody help, please?

Cheers
Philip
0
stadler
3/8/2005 12:45:14 PM
comp.text.pdf 5600 articles. 0 followers. ramon (1518) is leader. Post Follow

1 Replies
19242 Views

Similar Articles

[PageSpeed] 20

Philip Stadler wrote:

> I'm using an old version of pdflib (2001) under Java, and right now
> I'm unable to provide the exact version, sorry.

Updating to some slightly newer version may be a good idea.
In any case, p.get_parameter("version", 0) will tell you the
version number.

> Is there a way to get the character width of a monospaced font? In
> Java I would use something like this:
> 
>     Font f = ...;
>     Graphics g = ...;
>     g.setFont(font);
>     FontMetrics fm = g.getFontMetrics();
>     int charWidth = fm.charWidth('A');
> 
> Is there something equivalent for pdflib??? Can anybody help, please?

The stringwidth() method will provide the width of a (single- or
multi-character) string, regardless of whether the font is
monospaced or not.

Thomas

P.S.: The PDFlib mailing list is a better place for all PDFlib-
related questions.

_______________________________________________________________
Thomas Merz          tm@pdflib.com        http://www.pdflib.com
Personalize PDF: PDFlib Personalization Server and Block plugin
_______PDFlib - a library for generating PDF on the fly________
0
Thomas
3/8/2005 9:20:00 PM
Reply:

Similar Artilces:

pdf \ text (get rid of text in pdf)
Is there a way to remove all text from PDF? Will extract images work for you? If so, PDF-Tools by Tracker Software will do it. http://www.docu-track.com/ -- Don Vancouver, USA "MarosV" <maros.vranec@gmail.com> wrote in message news:ebb897e1-c8e3-4b3a-9274-dfd9d2c845c3@c4g2000hsg.googlegroups.com... > Is there a way to remove all text from PDF? ...

get width of variable-width font text in pixels for treeview column resize
I have a treeview object with a column that could have a lot of text in it.= I'd like to resize the column to be as big as the largest item. With a hor= izontal scrollbar, the user could then see all of the text. However, I can'= t figure out how to get the width of the text that was added to the item. S= o I can set the size to be some wild guess based on the number of character= s, but my font is variable-width, so this is likely to be very wrong. To help explain my dilemma, here's an example. The following script creates= a treeview widget and a horizontal scrollbar. It then ...

setting text in label to desired width in terms of number of characters , VNC-Exceed Font problem
Hi all, I am new to Tcl/Tk. I got a problem related to setting the width of text in label using the '-wraplength' option. I wanted to use "-wraplength" option on the text in the label, setting it to the specified length. I've gone through the online manuals avilable and I found out that the length must be specified in the standard forms of screen distances... but my requirement is that the label must be 100 characters wide..In standard forms of screen distances we generally write as 100c or 100i or 100metc.. c denoting centimeters, i for inches ,m for millimeters etc.....

adobe professional extract character set fonts from pdf to edit pdf file
Having spent $400 on Adobe 'professional' edition, I cannot edit a simple PDF document without purchasing a whole lot of type from the adobe store that could easily cost $1,000. There must be some catch here! How is it that I can purchase Adobe Photoshop and not have to buy additional Pantone colours (because they are all included in the program) and yet I am forced to buy fonts in order to edit pdf documents? The Adobe 'Profesional' program is sold on the basis that I can use it to edit pdf documents, but Adobe conceals the fact that before I can use the program for editing...

Get text width
Hi! I have a text and I need to get its width in pixels. The font size is not fixed. I've been suggested to put the text inside of an invisible div and get the div's width. But I would need to force the div to shrink to fit the text. Any idea? Thanks in advance I answer my own question: it's better to use a span element. function getElementWidth(Elem) { if(document.getElementById) { var elem = document.getElementById(Elem); } else if (document.all){ var elem = document.all[Elem]; } xPos = elem.offsetWidth; return xPos; } <span id="test">asdfasdf</s...

How to get text from PDF?
Hi all, I have my web server bases on linux. I am working on a project for which I need to get text out of PDF file. I need to know which text belongs to which PDF page number? Is there any utility/tool that should be installed on linux and I can use it from command line in PHP through exec() or system() etc for this purpose? Please reply me urgently. Thanks in advance. Shahid wrote: > Hi all, > > I have my web server bases on linux. I am working on a project for > which I need to get text out of PDF file. I need to know which text > belongs to which PDF page number? >...

How to get text from PDF?
Hi all, I have my web server bases on linux. I am working on a project for which I need to get text out of PDF file. I need to know which text belongs to which PDF page number? Is there any utility/tool that should be installed on linux and I can use it from command line in PHP through exec() or system() etc for this purpose? Please reply me urgently. Thanks in advance. On 22 Dec, 15:03, Shahid <mirzashahidmahm...@gmail.com> wrote: > Hi all, > > I have my web server bases on linux. I am working on a project for > which I need to get text out of PDF file. I need to know w...

How to Get a Monospaced Font
I'm trying to draw strings to a <JPanel>, and would like them to be drawn in a font where each character has the same pixel width. I had thought that "Courier" was such a font, so I wrote the following program to verify that its characters do in fact have the same pixel width, but when I tried running it I saw that they did not. For example, the small "i" is very much narrower than the capital "W". Can someone tell me a font I can use that might have a chance of being monospaced? I think I asked something similar to this before, and somebody ...

How to set width of text input to physical text width
I have a grid. When the focus is put on a cell an input is created with the value being the cell's text. I would like to size the input to the physical width of the text. Ideas? John function editCell (cell) { if (document.getElementById) { cell.normalize(); var input = document.createElement('INPUT'); input.setAttribute('value', cell.firstChild.nodeValue); input.setAttribute('size', cell.firstChild.nodeValue.length); //RATHER THAN SET THE SIZE, I WOULD PREFER TO SET STYLE WIDTH input.onblur = function (evt) { setCell(this.parentNode,t...

get text width #2
Is there a way to know the overall width of a piece of text? Not the width of, say, a single line P tag but any words it may contain. I've been given a problem where text that is dynamically created is supposed to be neatly wrapped in a styled DIV. Andrew Poulos Andrew Poulos wrote: > Is there a way to know the overall width of a piece of text? Not the > width of, say, a single line P tag but any words it may contain. > > I've been given a problem where text that is dynamically created is > supposed to be neatly wrapped in a styled DIV. The browser and its HT...

Getting the Text from Image and PDF
Hi friends, This is Jan, I am new to this Group. I have a requirement here. Is there any Java API for getting the Text data from an Image and PDF formats. Please let me know the same. If anything found, please suggest me regarding them. Thanks && Regards.. Jan Jan <janreddy.sr@gmail.com> wrote: > Hi friends, > This is Jan, I am new to this Group. > I have a requirement here. > Is there any Java API for getting the Text data from an Image > and PDF formats. For reading characters from graphical data, google "ocr"...

ANN: Fly Text to PDF
Hi All: Fly Text to PDF 1.3 is powerful tool which can convert your text files into PDF. This tool is powerful converter tool running on Microsoft Windows Operating System. You can use this tool to convert your text report, text documents and other text files into PDF quickly and easily. You also can set the PDF properties in each text files by using special tags, or set the default properties for every output PDF files. Please visit our website for more information: http://www.medafan.com/pdf-tools For the output sample, please click on: http://www.medafan.com/pdf-tools/license.pdf Key fea...

PDF font/character problem
I am sure there is an established solution for such problems, but I am having trouble with a pdf file where the text appears correctly on screen but does not print correctly. The "Print as Image" workaround is not an option due to the circumstances of the project. I believe this is an issue regarding the font embedding because when I attempt to convert the PDF to EPS or PS in Adobe Acrobat 7.0 Pro, the files turn out with jumbled text like the printouts do. I was wondering if anyone can recommend a solution. I was thinking that if there was a way to vectorize the PDF file, so that ...

Getting ugly fonts in pdf
Hi all, I am posting my question here because I could not find appropriate place in news group. I am trying to convert latex document to pdf. but fonts in that pdf document does not look gook. Anybody have some idea. here is my latex document. \documentclass{article} \usepackage{/usr/local/lib/R/share/texmf/Sweave} \begin{document} \title{Learning LateX} \author{By Denna} \date{\today} \maketitle This Example shows how to create .pdf file from .Snw using R: \begin{itemize} \item Step1 Create .Snw file using emacs or any other editor; \item Step2 Use Sweave() command of R.This command w...

Asian fonts in text pdf
I maintain an application that creates text based PDFs. The source data is in UTF-8 format. I have no problem with Western European languages, I just convert the UTF-8 to codepage 1252 and specify "Encoding WinAnsiEncoding" in the font object. I was wondering if there was an easy way to deal with UTF-8 encoding of other languages, particularly Asian languages such as Japanese and Chinese. I don't want to include my own font tables, just use whatever is installed on the local system. On May 14, 5:32=A0am, "Jeff McKay" <jeff.mc...@comaxis.com> wrote: > ...

height and width of characters in current font
Hello, could somebody tell me how I could get informations about the geometry of characters? With \hphantom and \vphantom I can produce space with the right width and height but I need the units. In my case I need to know the width of a \space, because I want to insert a \hspace command, similar to this: \hspace{-2\hphantom{\space}} Thanks in advance Uwe On 15 May 2004 04:47:56 -0700, Uwe St?hr <uwestoehr@web.de> wrote: > Hello, > > could somebody tell me how I could get informations about the geometry > of characters? > With \hphantom and \vphantom I can produce spac...

Get the optical size of a character or text?
Hello here, is there any way to get the real optical size of a character (height and width)? (I could only get the one with whitespaces around.) On Dec 24, 11:07=C2=A0am, K=C4=81rlis Repsons <reps...@gmail.com> wrote: > is there any way to get the real optical size of a character (height > and width)? (I could only get the one with whitespaces around.) Not sure if this is what you're looking for, but here it goes: \documentclass{minimal} \newlength{\myLen} \begin{document} \settoheight\myLen{M}Height is \the\myLen\ and width is \settowidth \myLen{M} \the\myLen. \end{docume...

How to get a list of fixed-width fonts?
Does anyone know whether there is an easy way to get a list of all fixed-width fonts installed on a particular Tiger? Ronald In article <a0c5a74e-0ad2-4c55-a950-9619d63d36d7@e10g2000prf.googlegroups.com>, Ronny <ro.naldfi.scher@gmail.com> wrote: > Does anyone know whether there is an easy way to get a list of all > fixed-width fonts installed on a particular Tiger? You might try FontDoc: <http://www.macupdate.com/info.php/id/16263%3E> -- Note: Please send all responses to the relevant news group. If you must contact me through e-mail, let me know when you send...

Module to get text from a PDF page?
I'm looking for a Perl module that will give me the text from a page of a simple (uncompressed, unencrypted) PDF. I've found several modules on CPAN that will write text into PDFs, but nothing to get it out. The closest possibilities look like PDF::API2 and Text::PDF. I've been working with them, and they seem to be able to get at a lot of meta-information in a PDF, but unable to get at the actual text in the file. My workaround is to shell out to pdftotext to get the text, but I'd like to have a pure-perl solution if possible. Does anyone know of a module that can do thi...

Help reading PDF to get text...
Hi, I need help with PDF::API2 or TEXT::PDF::* or any module which can b used to read pdf files. I have been trying to find any other thread which address this... but was unable to get a resolution. I have a bunch of pdf reports which I need to read through to find text string in any of the lines to read the report name. Any help is appreciated. Thanks.[COLOR=firebrick - tq_aud ----------------------------------------------------------------------- Posted via http://www.codecomments.co ----------------------------------------------------------------------- ...

Are character widths of Tahoma font fixed?
I'm investigating how to determine the width of a label that has Tahoma 8 in it. If I had a table with say: Tahoma Letter Pixels ------------------- ----------- a 10 b 12 .... ... i 3 j 7 ! 3 * 8 Could I use this table to add up the pixels in a string of characters, then do a Pixel To Twips conversion? In other words, are the individual letters themselves a fixed width? And if all thi...

Viewing PDF with characters from missing fonts
Acrobat (and presumably Reader) will open PDF documents that reference missing fonts with a justafiable warning. Ghostscript and GSView won't. Given that semiconductor datasheets originating from Japanese vendors usually have bits of text that (usually) don't relate to the technical content of the document but happen to include Kanji, it is a persistant annoyance that Ghostscipt appears to fail completely rather than simply rendering some kind of missing-character glyph. Are there any easy answers? Could a future version of Ghostscript handle missing characters more gracefully? Is ...

Rendering text when both Widths and font itself are missing
Hi, the file ""Photoshop File Format.pdf"" (377,487 bytes) PDF 1.1 Some of the texts are rendered with Courier font, but both Widths and the reference to an embedded font itself are missing. Both Reader and GSView render the textes properly. But what should I do as a developer to properly render each character in the "http://www.adobe.com" tesxt below if I don't know what the widths is. I know Courier is a mono-spaced font, but does it mean I should assume some default width (knowing at the same time that the default value for MissingWidth property is 0) Th...

PDF::API2::Text::font fix.
Howdy, Not sure what email address to send this to, so I'll post it here. If somebody could add this or something like it to the PDF::API2::Text::font function in the PDF::API2 Distro it would be usefull to many IMHO. All I added was the hail mary to get the font size. Basically: $txt->font($small, 20) ; Can be stated as: $txt->font($small) ; if the font contained in $small already knows what size it is. This makes managing your fonts a little cleaner. The replacement function: ########################## sub font { my ($self,$font,$size)=@_; if (! defined $siz...

Web resources about - getting character width of monospaced font with pdflib - comp.text.pdf

Samples of monospaced typefaces - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

App Store - Nocs™ — text editor with Dropbox & Markdown
Read reviews, get customer ratings, see screenshots, and learn more about Nocs™ — text editor with Dropbox & Markdown on the App Store. Download ...

Unicode - Wikipedia, the free encyclopedia
This article contains special characters . Without proper rendering support , you may see question marks, boxes, or other symbols . Unicode is ...

EtherPad: Minutes-PPIGA2014-sunday
EtherPad Server Notice : hide Public Pad Pad Options Import/Export Saved revisions Time Slider Save Cancel Import from text file, HTML, Word, ...

The Writing App Is Mightier Than The Sword
... elements when it comes to selecting documents, but the actual writing interface is amazing. The font is one of my favorites, personally (monospaced ...

wiki:syntax [Buxr Wiki]
DokuWiki supports some simple markup language, which tries to make the datafiles to be as readable as possible. This page contains all possible ...

Envy Code R preview #7 (scalable coding font)
It’s been a struggle but finally after countless hours here it is, the next release of my Envy Code R monospaced (fixed-width) font designed ...

Screenshot tour: Vimium Chrome extension provides ultimate keyboard surfing
Vimium is an incredible Chrome add-on for keyboard-only Web navigation. Its basic shortcuts are modeled after those used in the ubergeek-oriented ...

Dunwich Type Founders
Home Fonts Armitage Black Monday Downturn Lorimer № 2 Lorimer № 2 Condensed Recovery Sybarite Blog About DTF Contact Custom Type EULA About James ...

Finally, A Line Of Fan Gear For People Who Hate Sports
For me, it was 7 a.m. on a Sunday. I woke in my dorm room with a horrendous, mind-crushing, stomach-churning hangover, to a bunch of idiots yelling ...

Resources last updated: 2/28/2016 12:28:43 PM