I am developing a plugin which writes data in a particular location in a pdf. First I was using hardcoded font width and height as well as other font attributes like name (CourierStd), type(Type-1) etc. But now want to get these font attirbutes according to the pdf on which my plugin is doing the processing. I am not able to figure out any API to extract text from the pdf and then use that text to get the font attributes.
Can anyone please suggest a way to get the font attributes used in pdf or a particulsr pdf page???
Thanks in advance.
The PDFEdit APIs will give you that information.
Reply-To: "firstname.lastname@example.org<mailto:email@example.com>" <firstname.lastname@example.org<mailto:email@example.com>>
Date: Fri, 18 Nov 2011 00:03:03 -0800
Subject: Re: How to get font attributes(height,width,name, type) of a PDF or PDF page? How to get font attributes(height,width,name, type) of a PDF or PDF page?
How to get font attributes(height,width,name, type) of a PDF or PDF page?
-- Roy Zider
You missed your calling, irosenth. You should have been a lawyer. The helpful response is to 1) give a complete answer, such as here's how you do it in user space, and 2) answer the question I posed. Since you're a developer, surely you know the answer.
Surely you don't think somebody is going to write some code in order to check the typeface of a pdf he is trying to copy or reference, unless it's absolutely necessary, do you?
In any case, I happen to be working through many of the issues surrounding the use of this API, and they're not pretty. Simple solutions are always welcome.
-- Roy Zider
I do standards – it's similar :).
But I am still not understanding your need.
A PDF doesn't have font attributes nor does a PDF page. Only the actual text on a page have such attributes.
So not really sure what you are asking about.
Also, you haven't told us the development environment/language/platform you are working with. Also, are you planning to work with Acrobat or Reader or the Adobe PDFLibrary.
I was adding my comment to the query of the original poster. In his post, he was looking to identify the fonts and attributes of a pdf page at a particular point (" a particular location in a pdf. ")
The question was not answered. Your response was "The PDFEdit APIs will give you that information". I didn't understand the associated links, as they appear to be email links, not links to helpful answers. But I did understand your answer to be, effectively, RTFM. That answer you characterized as a "developer's answer". Did I get that right?
I know the font on the PDF is CourierStd because Word says its font is 'Courier Std", not because I was able to pluck it from the PDF. Right clicking for a context menu properties of a selection doesn't yield a 'Properties' selection, so the user can't identify the font he or she is looking at. At least I wasn't able to do it, and that is the gist of my interest in this original post.
I don't think it's reasonable to write a program to have to do this, but of course if it can't be done otherwise, and hasn't been impleted yet in the tenth turn of the version crank of Acrobat, then reference to the API will be necessary. But even then, RTFM does not appear to me to be particularly helpful.
Message was edited by: FUBARinSFO
MSWord 2007 doesn't support reading PDF files – so how would it be translating or mapping fonts from a PDF??
Are you using some program to convert PDF to Word? If so, what program? Adobe Acrobat? What version?
If you use the Edit Object or Touchup Text tool in Acrobat, you can select pieces of text, right click for Properties and see what font (etc.) has been used. This has been part of Acrobat since at least version 5.
Yes, that's true. Word 2007 does not read PDF files.
Perhaps it was not clear, but when you document a js file by writing the documentation in Word, you sometimes have occasion to cite code snippets from the JS API reference. Copy/paste into Word of the text selection in the PDF results in the mismatch, because CourierStd/Courier Std is what Word 'says' is the font it has pasted into the docx, but is the name and not the actual font it is using (since it's not installed).
Both the Edit Object Touchup Text tools do the job. Thanks -- that's what I was looking to solve. Would have been nice to just be able to paint the selection and get the Properties from the context menu, but this is better than writing a script to reference the API, don't you think?
Seems Adobe could have improved on this since version 5, but then maybe things move a bit more slowly in Adobe-land than elsewhere.
-- Roy Zider