Centered text in PDF

Hi
I am new to this Acrobat SDK forum. I am trying to write a PDF code, but I have problems centering text. Below is a short "program" that writes the text "Centered text" starting at position x=100, y=600. But how do I center this text at some position, say x=200, y=600 ?  Can anyone help?
- gullipeX
%PDF-1.4
1 0 obj
   << /Type /Catalog
      /Outlines 2 0 R
      /Pages 3 0 R
   >>
endobj
2 0 obj
   << /Type /Outlines
      /Count 0
   >>
endobj
3 0 obj
   << /Type /Pages
      /Kids [ 4 0 R ]
      /Count 1
   >>
endobj
4 0 obj
   << /Type /Page
      /Parent 3 0 R
      /MediaBox [ 0 0 612 792 ]
      /Contents 5 0 R
      /Resources << /ProcSet 6 0 R
                  /Font << /F1 7 0 R >>
                  >>
   >>
endobj
5 0 obj
   << /Length 73 >>
stream
BT
   /F1 24 Tf
   100 600 Td
   ( Centered text ) Tj
ET
endstream
endobj
6 0 obj
   [ /PDF /Text ]
endobj
7 0 obj
   << /Type /Font
      /Subtype /Type1
      /Name /F1
      /BaseFont /Helvetica
      /Encoding /MacRomanEncoding
   >>
endobj
xref
0 8
0000000000 65535 f
0000000009 00000 n
0000000074 00000 n
0000000120 00000 n
0000000179 00000 n
0000000364 00000 n
0000000466 00000 n
0000000496 00000 n
trailer
   << /Size 8
      /Root 1 0 R
   >>
startxref
625
%%EOF

Hi, Irosenth and others again.
To try to solve my problem (because I do not know how to do this in PDF), I made a short PostScript program to check the length of the characters in Helvetiva 10 pt. A part of the program is shown below. If I have the length, I can calculate the centered position of the text in my C or Fortran program, that makes the PDF file.  This investigation gave, for instance, the lengths for A, B and W as:
A:  6.66797
F:  6.10840
W: 9.43945
When I placed the EPS file into Adobe InDesign a bit different values came out:
A:  6.66959
F:  6.10963
W: 9.43942
... and still different in Adobe Photoshop:
A:  6.67081
F:  6.11075
W: 9.44115
I have the feeling that character lengths are given as integers in the font file (not as real numbers) and I actually have to multiply these lengths (for 10 pt. Helvetica)  with some unknown value to find the "correct" lengths of the given characters. Does anyone know the actual length of the character A in Helvetica for instance?
PostScript program:
/Helvetica findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
end
/Helvetica-ANSI exch definefont pop
gsave
/str 20 string def
/Helvetica-ANSI findfont 10 scalefont setfont
(A ) 50  750 moveto show
(A)  stringwidth pop str cvs  80 750 moveto show
(F ) 50  700 moveto show
(F)  stringwidth pop str cvs  80 700 moveto show
(W ) 50  650 moveto show
(W)  stringwidth pop str cvs  80 650 moveto show
grestore

Similar Messages

  • How to change text in PDF doc. which is a musical score

    Hello,
    I'm new here, so please excuse me if I do or say something I shouldn't.
    I need to change the words in a musical score because the font is too small. OCR recognition doesn"t work because there are illustrations that are different from images or text... Is there a way to get in there and make the changes I need to do?
    Any help greatly appreciated.

    Thanks for the reply, but I have Adobe Reader 9 Pro. Will it still not 
    work ?
    Le 29 sept. 2011 à 29 sept. 11 - 16:09, Claudio González a écrit :
    Re: How to change text in PDF doc. which is a musical score
    created by Claudio González in Adobe Reader - View the full discussion
    Unfortunately, not with the free Reader.
    Replies to this message go to everyone subscribed to this thread, 
    not directly to the person who posted the message. To post a reply, 
    either reply to this email or visit the message page: [http://forums.adobe.com/message/3944833#3944833
    To unsubscribe from this thread, please visit the message page at [http://forums.adobe.com/message/3944833#3944833
    ]. In the Actions box on the right, click the Stop Email 
    Notifications link.
    Start a new discussion in Adobe Reader by email or at Adobe Forums
    For more information about maintaining your forum email 
    notifications please go to http://forums.adobe.com/message/2936746#2936746

  • How can I digitalize a document text in PDF and export it to WORD?

    Anthony
    How can I digitalize a document text in PDF and export it to WORD?

    If you already have a PDF document, ExportPDF can help you with this task. https://www.acrobat.com/exportpdf/en/convert-pdf-to-word.html
    On the other hand, if you have a physical document, you'll need to scan it into a PDF document first.
    Depending on what you need to do you may require different tools & services, so please help us out with more details.
    Vlad

  • Changing the seeded rdf report output from text to PDF

    Hi All,
    I am trying to change the seeded report "Print Requisition Report" output from text to PDF. I changed the output format in the concurrent program definition from text to pdf. The report is now getting displayed in pdf format, but the alignment of the fields are changed. The output is not printing as it was printing while in the text output format. The output looks very sloppy, with uneven fonts and too much of text wrapping.
    I tried some formatting and fields are somehow getting displayed but doesnt look in proper format. I am not able to change the font style in the report builder 6i, even if i change it is printing in the same font style with uneven font size. I think reducing the font size might help, but i am unable to change.We are on 11.5.10.2. Please provide your valuable suggestions on how to go about.
    Thanks
    Sarvesh

    Hi Hussein,
    Thanks for the information. After the adjustments in the layout and the font change the report is now getting displayed without any clipping when clicked on view output. But when the same report is printed some characters on the left and and right side is getting clipped. Please help on how to solve this issue.
    Thanks,
    Sarvesh

  • How to read/extract text from pdf

    Respected All,
    I want to read/extract text from pdf. I tried using etymon but not succed.
    Could anyone will guide me in this.
    Thanks and regards,
    Ajay.

    Thank you very much Abhilshit, PDFBox works for reading pdf.
    Regards,
    Ajay.

  • How to upload a text in .pdf to convert it?

    How to upload a text in .pdf to convert it?

    How to upload a text in .pdf to convert it?

  • How to change background color of text in pdf based by font name

    Hi
    How to change the background color of text in PDF based by font name. Is there any option in Javascript. e.g: If PDF containing ARIAL font, the ARIAL text background color needs to be changed in red color for all pages. Same for all fonts with different different color in the PDF.
    Thanks in Advance

    Hi
    1) Is there any possibilities to highlight with different color based on font using javascript
    2) list of font used in PDF using javascript
    3) How to hilight the text using javascript
    Thanks in Advance

  • How to write a unicode text in pdf file

    Dear Friends,
    I am a beginner in acrobat pdf plug-in development. I was trying to write a unicode text (Tamil text) into pdf file.
    Using same api I am able to write english text in time-roman, areal etc fonts. But I am not able to write tamil texts.
    The code is as below:
            memset(&pdeFontAttrs, 0, sizeof(pdeFontAttrs));
            pdeFontAttrs.name = ASAtomFromString("Latha");
            pdeFontAttrs.type = ASAtomFromString("TrueType");
            pdeFont    = PDEFontCreateFromSysFont(                                        \
                            PDFindSysFont(&pdeFontAttrs, sizeof(pdeFontAttrs), 0),    \
                            kPDEFontCreateEmbedded);
            pdeText = PDETextCreate();
            PDETextAdd(pdeText, kPDETextRun, 0, (ASUInt8 *)buffer, _tcslen(buffer),
                                    pdeFont, &gState, sizeof(gState), NULL, 0, &textMatrix, NULL);
            PDEContentAddElem(pdeContent, kPDEAfterLast, (PDEElement)pdeText);
            PDPageSetPDEContent(pdPage, gExtensionID);  
            PDPageReleasePDEContent (pdPage, gExtensionID);
    KIndly assume that PDEGraphicsState and PDETextMatrix are set properly set, I am not pasting entire code to avoid complexity.
    Thank you,
    Safiq

    Dear lrosenth,
    I went through some codes/suggestions in internet and I found that I need to have cmap file and cid font file for the respective font since pdf doesn't support unicode fonts directly.
    Can you help me to know where can I get cmap file and cid font file for tamil language font Latha(TrueType) microsoft font.
    Regards,
    Safiq

  • Why can't I "Save as Text" a pdf file received as an email attachment?

    I can "Save as text" a pdf file which I have created in my own computer (that is, it goes into MS notebook that I then can Copy and Save as an MS Word file) but not when I receive a pdf as an email attachment. (The file is saved, but it is empty.) Why would I want to convert my own pdf back to text? Well, in case I no longer have the original Word document I suppose, but the thing is "Save as text" works with my pdf, but not with those I recieve from others. How come? Thanks!

    Is this a scanned PDF? If so, it must first be OCR'd.

  • Randomly Missing Text in PDF Created from FrameMaker

    This problem relates to a structured FM document, but I suspect it might be a general issue and have posted it here in the general forum for that reason.
    I am generating PDFs that are missing text somewhat randomly throughout. I tried searching the forum for solutions, but none of the suggested fixes worked and none of the posts specifically addressed the issue I am experiencing.
    I am working in structured FM. The templates we use were originally created for FM8. We use both FM8 and FM10 in our work group. We are able to duplicate the same problem in both versions and on multiple computers.
    I thought I had narrowed the problem down to certain paragraph formatting, since it only ocurs in three or four paragraph formats (a bullet list, table text, etc.) Garden variety formatting. But in most places in the document, these formats appear perfectly. The strangest occurence is a single intance where the page number is missing from the footer.
    I thought it might be a font issue, as I've had similar issues in the past. I had a missing font warning in the console, but I am pretty sure that this has nothing to do with it, since they are fonts we are not using and all the other text from the same formats appears.
    I tried turning off "Remember Missing Font Names" in preferences. No help.
    I checked that the fonts are in the local directory and appear as embedded subsets in the PDF.
    I also tried checking and unchecking the "Rely on system fonts only; do not use document fonts" option in the PDF output settings. Also no help.
    The randomness of the missing fonts bewilders me and I've exhausted my own troubleshooting abilities. I would be happy to share a source file if anyone thinks they could help me that way.
    Thanks in advance,
    Douglas

    There is a known bug in Windows XP that causes random dropped text in
    PDF. The hotfix is here, though the link does not seem to be working at
    the moment:
    http://support.microsoft.com/?id=952909
    However, the above link directs you to a download link that is here:
    http://support.microsoft.com/Hotfix/KBHotfix.aspx?kbnum=952909&kbln=en-us <http://support.microsoft.com/Hotfix/KBHotfix.aspx?kbnum=952909&kbln=en-us

  • How to Extract the Highlight Text in PDF File

    Hi Scripters,
    i want know, how to extract the hightlight text in pdf files for text only format for (*.txt) file extension save.
    regards
    baby

    Hi,
    Okay i'll try do best.
    thanks for your reply.
    Regards
    Baby

  • Paid to allow edit text in PDF, and not working

    I wanted to 'edit' text in PDF and followed the instructions, it told be to subscribe and pay to do this.  I did subscribe and pay, but the functionality is still not working, keeps directing me to subscribe and pay.

    Hi rrobati,
    I checked your account,your Export PDF subscription is not confirmed yet at our end.
    Once it gets confirmed you will be able to use it hassle free.
    Regards,
    Florence

  • Search text in PDF and MS Word document

    Can any body tell me how search text in PDF and MS Word document through Java code, any body has code or any suggestion to give
    Thank You
    Adnan

    Can any body tell me how search text in PDF
    and MS Word document through Java code, any
    body has code or any suggestion to giveYes.
    First, you need to work out how to read each document type from Java.
    E.g, for MS Word you could use Apache Jakarta POI - HWPF: http://jakarta.apache.org/poi/hwpf/index.html
    Then, you use Apache Lucene to index and search.
    See http://lucene.apache.org/java/docs/index.html
    ~D

  • How to put text in pdf on ipad

    How to put text in pdf on ipad?

    The only text you can attach to a PDF in the current Adobe Reader is a "note" comment. If you tap the comments button (the cartoon cloud with pencil) and choose the "note" comment (the cartoon cloud) you can add a note.

  • Texts in pdf form don't appear when viewing in Acrobat nor in Reader.

    Texts in pdf form don't appear when viewing in Acrobat nor in Reader nor when printed after the form has been filled. But the texts appear when one clicks inside the field. What is the solution to be able to print and view all of the texts in all of the fields that have been typed.

    More than likely caused by someone filling out the form with Mac Preview.
    Here's a potential fix: http://kb2.adobe.com/community/publishing/885/cpsid_88564.html

Maybe you are looking for

  • Convert xml file to a 2D list - Urgent!!!

    I have a xml file like: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE map SYSTEM "map.dtd"> <map width="5" height="3" goal="6" name="Hallways of Dooom">      <random-item type='lantern' amount='5' />      <random-item type='health' amount='10' />

  • 11g Tutorial "classes" not found

    I was going through the setup steps to install the "Oracle ADF: Build a Fusion Web Application" tutorial found under Turoials this site and when I run the "build.xml" ant file an error is display that says: BUILD FAILED C:\download\jdeveloper\FOD_11\

  • Kernel_task at %300  ! Nothing seems to work

    Hi A few months ago my computer gradually started to run slow. At first I didn't really notice it but now it is almost unusable. I'm running Mountain Lion OS X 10.8.2 on a late 2011 MBP, Processor: 2.8 GHz Intel Core i7, Memory 4GB 1333 MHz DDR3 The

  • Custom Product Maintain SP?

    How to maintain Support Package Stacks information in SLD for a custom product?

  • ITunes 9.2: Lots of errors

    I've recently downloaded and installed iTunes 9.2, but there are lots of errors. The executables MobileBackup, MDCrashReportTool, MobileDeviceHelper and Upgradedb crash on the way to iTunes. I have an iPhone 3GS and Windows XP Professional. Well, i'm