Generating PDF from a C program. How do I get dimensions of rendered text?

Hello.
I am generating a PDF file from withing a C program I am developing and I am running into trouble measuring the dimensions of arbitrary text string when rendered on the page. Even if I had widths of individual glyphs in the font I am using, I would still run into trouble considering ligatures. My questions are the following:
When I generate a PDF file, I have to provide the /Widths array dictionary entry for the font I use. How do I get these values? Is it possible to get them out of the font file (OTF/Type-1) easily?
If I do have the widths of individual glyphs and the ascent/descent values for the whole font, I still need ascent/descent for individual glyphs so that I can typeset things perfectly. How about these? Can they be read from the formats mentioned above?
What confuses me is this. A PDF writer (be it Microsoft Word) knows the font it is using to write text, obviously. When it saves the document as PDF, does it really inspect the font to dig out the glyph sizes?
I do not use any libraries whatsoever, I am generating the whole file and its PostScript streams "by hand".
Thanks!
David

1. Yes, you need to provide Widths and they MUST be right (a conflict with the font values is bad news). It depends what you mean by "easy". It's possible to parse each different font type, but hard work, at least for the format I understand (type 1). If the font is installed in the system you can use the OS to return font metric information for most things. StemV/StemH are a particular challenge as the values are not in type 1 fonts.
It is tough enough for type 1 fonts that the AFM format was invented to provide font information in simple text format, and there should be an AFM for every type 1 font. Be sure to retrieve metric information at a very large size to avoid rounding issues. If you are working with the base fonts only it's easy enough to generate a table for them.
Ligatures should be no issue at all. A ligature is a single glyph with its own metrics. You either use the individual characters (so ligatures are irrelevant) or you replace groups with a ligature (at which point it becomes a single glyph to manage). There is no automatic conversion of ligatures.
2. This would be in the font, but it would be most unusual to make use of individual glyph's ascent/descent in typesetting layout calculations, as I understand it. The important things are
(a) use font ascent/descent over the whole line for all fonts and sizes used to ensure there is enough room for characters
(b) set each glyph on the same baseline
What do you see yourself as doing with the glyph ascent/descent?
If an application generates PDF, then it really must do this stuff. Word knows all this anyway, because it needs to do the calculations to place text on screen.
Please do not try to generate PDFs entirely by hand. Many people try, but nobody manages to get stream length and xref entries right. You cannot rely on PDF readers to repair. Please write your own software to generate these things. PDF is not a text format, even though it has a lot of text in it.

Similar Messages

  • How to generate PDF from template via REST query

    Hello. I'm newbie in Adobe LiveCycle, will appreciate any help.
    What we need: generate PDF from template, using different data.
    What we have: LiveCycle Designer and server with deployed Adobe LiveCycle ES 2.5 image.
    Looks like server works and listen 8080.
    In Livecycle Designer I can generate XML (XDP) from PDF, so I can change this XML in PHP/Python/Go script to fill template with data.
    I'm looking for some REST method, where I can give that XML (XDP) and recieve generated PDF in response.
    I've spent whole to for googling all these things, found a lot of docs, but all is very complicated there. Also, examples from just doesn't work - maybe I have to do something on server before calling REST API method.
    Please, push me into right direction

    Your best bet is to probably create an orchestration (or "process" in Adobe speak) that accepts two document parameters, calls LiveCycle Forms (or Output depending on whether you want to interactive or non-interactive PDF), and returns the resulting document variable.
    The orchestration will return a redirect that will point you to the document object.
    See Invoking LiveCycle using REST Requests, and Creating Your First LiveCycle ES4 Application.
    Rob

  • Generating PDF from Microsoft Word with C#

    Hello,
    We have created web-based system for a customer that stores/handles Microsoft word documents and provides these to users as PDF versions. Unfortunately some problems appear with our third-party component that generates PDF from Word. Our customer has previously used Adobe Acrobat X Pro to manually generate the PDF files and is confident that the output produced this way is valid. Despite searching and reading a lot I can't find any way to determine if (and how) it is possible to automate the process of generating a PDF file from a Microsoft word file using the Adobe engine. There is a lot of SDK documentation, how to control PDF rendering in winforms applications etc. etc. All I want to do is to load an Adobe Acrobat instance, feed it with a word document and save it as a PDF on disk. From a C# app (ASP.NET). Is that possible?
    Best regards
    Jan Hansen

    As mentioned, you can probably send the DOC file to the Adobe PDF printer to create the file. What I keep reading in your post is a legal issue. You keep mentioning being able to create the PDF on a server automatically. The server use of Acrobat is a violation of the EULA. If you are creting the files off-line for posting as has been done, there should not be a problem. However, having these created in an automated manner by the user may be an issue. Before you go much further, I would check with legal counsel about the use of Acrobat in the way you intend. If they indicate there is a problem, then your question is not needed.
    Back to the issue. Try just dropping a DOC file on the Adobe PDF printer icon (you may have to open the Start>Printers to do that. See if that creates the PDF. If so, you will just need to automate that process.

  • Gray box for logo generating pdf from fm book

    Greetings,
    I have a large FrameMaker book that I've generated pdfs from a million times. We cleaned up our logo, so I dropped it in and tried to generate the usual pdf. a gray box resulted for the logo only. all other artwork displayed fine. i tried scaling down the logo, changing formats, changing import methods, etc. all failed. however, generating a pdf from the book if I remove a few chapters gives me my logo. Am I running out of resources? I'm using tech comm suite 1.3 on vista. There are no clues in the acrobat log. show large images is turned on in the adobe reader.
    I used the obvious workaround: generated two pdfs, one with just the logo page and one with the rest of the book, then combined them. But this process is not practical long term. Any clues?

    A couple questions:
    What format is the new logo file?
    Given that it works with some component files, but not in the book... I'd guess that it may be a resource issue. How much RAM and free space do you have?
    And when you "dropped it in," does that mean imported into one file by reference, or copied in, or imported into a template that you used to update all files in the book..... or something else? And if it did update multiple files, did you double-check them to make sure the path to the graphic is correct?

  • Generate PDF From Flex

    Hi All,
    I am doing a Reporting/Chart application in FLEX. we need to
    generate PDF from FLEX. Report data will be 5-10 pages, How we can
    do this? Please advise.
    Thanks
    Subhash

    Hi,
    thanks for your reply. I tried with alive pdf, but source
    code only AIR files. can we use this in web based flex?. How we can
    format the report like html code? I just see in alivepdf, its only
    linebyline display, not multiple columns? pls advise.
    thanks alot
    Subhash

  • My files, photos, email files, software programs, and all information did NOT transfer over to Mavericks (from Mt. Lion).  How do I get all my stuff to appear when using Mavericks?

    Will someone please help me?
    My files, photos, email files, software programs, calendar info, and all information did NOT transfer over to Mavericks (from Mt Lion).  How do I get all my stuff to appear when using Mavericks?
    My email did transfer over.
    Thank you.

    First click on the Apple > Logout and Log back in or restart the unit see if that solves it.  If it doesn't do you have a backup of your system prior to upgrade?  Check Disk Utility and see how much space is being used to make sure the drive wasn't somehow erased.

  • JNDI error while generating pdf from crystal reports in java

    Hi, i want to generate PDF from crystal reports in java. I have the .PDF file with database configured into the report. Following details are available in report.
    1. Server Name      = testdb
    2. Database Name  = testdb
    3. User
    4. Password
    I am using CR XI.
    In CRConfig.xml i had given following details.
    <JDBC>
         <CacheRowSetSize>100</CacheRowSetSize>
         <JDBCURL>jdbc:oracle:thin:@192.218.216.102:1521://TESTDB</JDBCURL>
         <JDBCClassName>oracle.jdbc.driver.OracleDriver</JDBCClassName>
         <JDBCUserName>user</JDBCUserName>
         <JNDIURL>password</JNDIURL>
         <JNDIConnectionFactory></JNDIConnectionFactory>
         <JNDIInitContext>/</JNDIInitContext>
         <JNDIUserName>testdb</JNDIUserName>
         <GenericJDBCDriver>
              <Default>
                   <ServerType>UNKNOWN</ServerType>
                   <QuoteIdentifierOnOff>ON</QuoteIdentifierOnOff>
                   <StoredProcType>Standard</StoredProcType>
                   <LogonStyle>Standard</LogonStyle>
              </Default>
         </GenericJDBCDriver>
    </JDBC>
    When i am calling from java as standalone, i am getting following error.
    JRCAgent1 detected an exception: Error finding JNDI name (testdb)
    at com.crystaldecisions.sdk.occa.report.lib.ReportSDKException.throwReportSDKException(Unknown Source)      at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
    Can anyone let me know where is the problem?

    Actually, the question boils down to; does the framework support the fonts?
    I believe that my question re. this working in the designer was valid. The designer does not use the framework, so if it works there, it is either a framework issue or a runtime print engine issue.
    I believe if you use the code below, it will list fonts available to the framework:
    foreach(FontFamily ff in FontFamily.Families)
    System.Diagnostics.Debug.WriteLine(ff.Name);
    For more information see kbase [1198306 - Crystal Report displaying incorrect font in Microsoft Visual Studio .NET|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333133393338333333303336%7D.do]
    Ludek

  • Generating PDF from MSWord--IsTable of Content Updated?

    Hello,
    In generating PDF from MSWord document does the Adobe process call a method on the MSWord object to update the TOC field in the Word document during the generation process. Or is it assumed that the table of content in the Word document is always updated. If the table of content field is not current, field error message can appear in the Word document and the page number for
    the link can contain inaccurate values.
    Thank you,
    Jesse

    It is assumed the TOC is up to date.

  • Generating pdf from scanner

    generating pdf from scanner hp G3010: old windows xp file weight 40-50 K. Macbook pro with new mac os 10.7.2 minimum file weight 1,9 Mbyte with terrible resolution!!!! and no way to reduce.
    Nice change?

    It is assumed the TOC is up to date.

  • I am able to generate PDF from Framemaker file but not able to generate pdf from book in robohelp

    Hi,
    Using robo help i am able to generate pdf  from a single framemaker file.
    but when i am importing whole book then i am not able to make it.
    And also it is not showing any error on console
    It goes to hang like situation and i have to close it from task maneger.

    Ok, silly question - why are you bothering to try and create PDFs from RH when you've got FM? FM to PDF produces great results; RH to PDF involves having to go through Word - i.e. RH - Word - PDF = too much work IMHO.

  • Generate PDF From Database

    Hi,
    I have a table in database. Table has a column. There is data of pathes of images into column. I cretaed a illustrator template and I want to generate PDF from this template with using table data in database. so, is it possible? illustrator created pdf per each image with using illustrator template.
    thanks,

    AI cannot conent directly to databases. It can only parse CSV/ XML data. You either need to export the stuff or create extensive scripts to connect to the life database using sockets.
    Mylenium

  • I have lost the iCloud program from my Mac. How can i get it back? It is no longer under system

    I have lost the iCloud program from my Mac. How can i get it back?
    It think i must have deleted it? It is no longer under the system choises.
    Does anyone know how i can get it back?
    I am updating to OS X Mountain Lion now, but i don`t know if that will fix the problem?

    Did you actually remove iPhoto or just the shortcut in the Dock?

  • When I convert a file from PDF to word it is all in characters how do I get it in english text

    Please could someone help me with a converted file. I have bought the adobe acrobat and tried to convert my PDF to word and it just comes up with characters how to I get it in normal text?

    Hello,
    because you wrote in the Reader forum, so I think we talk about it, or? In my case I can change the text there (screenshot of my German AR):
    I hope the image is selfexplanatory and I understood you in the reight way. If not please come back to set right.
    Hans-Günter

  • Generating pdf from RoboHelp gives "macro disabled" error

    I'm using RoboHelp 8 -> RoboHelp HTML, and I have MS Word 2007 and "Adobe PDF Creation Add-On 9" installed.
    To generate a pdf, I navigated to "Single Source Layouts" and double-clicked "Printed Documentation" (File -> Generate -> PDF should be the same), and I kept getting an error: "macros disabled. Please see printed documentation for enabling macros."
    I finally went to Word 2007, pressed the "button" (upper left), selected Word Options -> Trust Center -> Trust Center settings, and selected "Enable all macros." The default setting was "Disable all macros with notification."
    When I selected "Enable all macros," I could now generate a pdf - but what does enabling macros in Word have to do with generating a pdf? Maybe this has something to do with the order that Office 2007 and the "Adobe PDF Creation Add-On 9" were installed. It appears I do not have a bonafide version of Acrobat 9 installed (just Acrobat Reader 9.3), and maybe that's the problem. Thanks for any help or advice, Len

    Hi,
    I am hereby giving the explanation for this issue with screenshots:
    I have opened one of my RoboHELP project and right clicked on the Printed Documentation option.
    Here I found that the Set as Primary Layout option is disabled. Hence I clicked on Generate…
    Then the following window is displayed.
    I have clicked Next.
           Then the following window is displayed
    4. I have selected the complete TOC and clicked Next
          Then the following window is displayed
    5. Again clicked Next
    6. Then clicked Save and Generate.
        The following window is displayed.
    7. Then, I have clicked OK.
         After a while the following window is displayed.
    Solution
    1 Open a Word document. Click File > Options > Trust Center > Trust Center Settings...
    Select the Enable all macros
    Now, save the document and close it.
    Go to your RoboHELP source files. Now you can generate a PDF and/or a Word document.

  • Latest version of Lightroom will not download RAW files from my D750. How does one get around this? Bought Lightroom for it's ability to manage RAW files and now very disappointed.

    Latest version of Lightroom will not download RAW files from my D750. How does one get around this? Bought Lightroom for it's ability to manage RAW files and now very disappointed.

    Here is the contents of a batch file which will convert whatever raws you drop on it:
    "C:\Program Files (x86)\Adobe\Adobe DNG Converter" -cr7.1 -dng1.4 -p0 %*
    Once you download the latest converter (release candidate from adobe labs, if necessary), and save the appropriate contents of the batch file (change path to match your system, and parameters to match your druthers, if applicable), the procedure is:
    1. Drop raw files on bat file.
    2. Import as usual (the DNGs).
    Not too bad once you're set up (if DNG converter supports your raws).
    Documentation:
    http://wwwimages.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/dng_commandline.pd f
    Note: on Mac, you may need to use "$@" (with the double-quotes) instead of %* (which is dos batch syntax), and you will need to use the full path to the converter executable file, e.g.
    “/Applications/Adobe DNG Converter.app/Contents/MacOS/Adobe DNG Converter”
    If too much, just use the GUI instead of the bat file.
    Rob

Maybe you are looking for

  • How can i use jw player in as3 application?

    i want to use jw player bcause i want to Allowing users to jump to any point in a movie without having to wait for the entire movie to download . dose anyone now how can i do it ? so you have any example source?

  • Indesign won't import styles

    HI I want the paragraph styles from one document into an other so goto load styles and choose the ones I want from the other file and click OK< but nothing happns, they don't show. Both files a recent, running latest indesign CC. Any ideas?

  • Change Source System RFC

    Dear All, we have 2 server ecc 6. 1. production 2. backup right now my sap bw connect to ecc production. we have plan to use backup instead of production is it enough just simply changing the IP and host name at the current RFC connection. from IP pr

  • Source Code Control - Check in problems

    Some of my vi's have been marked as "Server copy has changed" and some have even been marked with "both local and server copies have changed". When this is the case I cannot find any way to check in my VI without getting an error. Looking for a work

  • Activation problem after several years of use

    I have used Photoshop cs v8.0 for several years on the same computer.  Yesterday when I tried to open Photoshop a popup windo said I needed to register my product to get my activation code.  The online method would not work, the phone method went to