(Acrobat XI) Using Javascript to scan PDF text

I am scanning text in a PDF and reading it into memory using doc::getPageNthWord().  Reading the text from the file using the mark 1 mod 0 eyeball looks like this:
References
Greenpeace. 2012. Safeway charts new course for
  sustainable tuna. www.greenpeace.org/usa/en/media-
  center/news-releases/Travis-Nichols.
Monterey Bay Aquarium. 2012a. Wild seafood issue:
   Overfishing, www.montereybayaquarium.org/cr/cr_
   seafoodwatch/issues/wildseafood_overfishing.aspx.
(Please note that I am unable to determine how the PDF is causing the indent.  I am using three spaces, but a hex editor...well read on, please).
Using the above function (i.e getPageNthWord()) the information comes in like   this:
Wild
seafood
issue:
• Ł Ł • • Ł Ł • • Ł Ł • • Ł Ł •
www.
Copying it to a text editor using the clipboard, it looks like this:
"Wild seafood issue:"
", OOHJDO              AVKLQJ.
Can anyone suggest a possible solution to getting the text in a readable format?
TIA!
John

I have some additional information.  When I copy the text to a programming editor I see the latter transformation.  When I compare the text, letter for letter, each letter in the cryptic version  has been reduced in value by 29 with a few exceptions; periods and forward slants do not seem to have been affected.  Additionally, the letters f and i, when placed together, are interpreted as a single letter with an ascii version of 195. 
I have looked at possible XOR/OR bit fiddling conversions, but have not been able to figure out what is causing the transformation (or causing the transformation to fail).

Similar Messages

  • How do I use Javascript to populate a text field based on a selection from a drop down box?

    Greetings,
    I have virtually no experience with JavaScript and I am trying to figure out how to add some basic automation features to an Adobe form.  I have a drop down box called "Hospital_Name" that will contain approximately 7 possible selections.  When the user makes a selection, I would like to have the text field (called "Hospital_Address") below the drop down box populate with the corresponding address for the selection.  I have the "Hospital_Address" text field configured for multiple lines and would like the address to have a line break between the street address and the city/state/zip.
    For example, if the user selected "Hospital 1", the text field would display:
    123 Main St
    Anytown, CA 12345
    Any help or examples you can provide would be greatly appreciated.

    You have the element names within the object within brackets.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    // some debugging code to see location names;
    console.show();console.clear():
    for(I in Location) {
    console.println(I);
    // end debugging code;
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;
    This is not a beginners task but requires a fair amount of knowledge about the structure of objects, defining strings, and structure of arrays.
    Are you sure you have all the field names correctly spelled and capitalized?
    Do you get any error in the JavaScript console?
    Just trying the line that defines the "Location", I get the following error:
    SyntaxError: invalid property id
    1:Console:Exec
    undefined
    All the form field in a PDF are processed by using JavaScript and any error in any script will stop JavaScript processing.
    It might help to have a link to the problem form.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;

  • Using Javascript to change multiple text field names

    I have a pdf with multiple text fields. I need to change all the text field names (General -> Name) so that they are unique so that when I combine multiple pdfs together, the text fields will stay intact. Is there anyway to do this using javascript? Thanks!

    I'm new to javascript too...it will be very helpfull for me too...Thanks
    poltrone
    prodotti chimici

  • Captivate: Using Javascript to show/hide text captions

    Hello,
    I want to show/hide a text caption using javascript. I can't find the way of doing it with advanced actions. I dont know if it's because it belongs to a question slide in a pool. Does somebody knows if it's possible and how it can be done??

    You can set the length of the variable when you insert it.
    15 characters is just the default setting.
    What I meant by COULD is that the kind of thing you are asking about here (using JavaScript to hide objects inside a Captivate movie at runtime) is not as simple as you'd like it to be.
    JavaScript is not my particular area of expertise, but there are some people that chime in on this forum that ARE experts at JS. But I think they would also be the first to say that it's not as simple a thing to pull off as just "knowing the command to hide/show an object".
    The easiest tool to use in Captivate for showing or hiding objects is Advanced Actions.  The next easiest thing to use is ActionScript 3, and that's hard.  JavaScript is a very useful programming language, but it spends all of its life outside the Captivate movie looking in through AS3's External Interface.  So JS alone is not going to solve all your issues.

  • Do I need to use javascript to get a text field in a PDF form to aut fill with current/today's date?

    I have a form for booking appointments and would like the date field to automatically fill with
    today's date and to print. I have set the text field's format to "Date" and when I place the cursor into the
    date field, today's date shows. It disappears as soon as I tab to the next field.
    Does this action require a javascript script to fill and print today's date? If so, where do I find that?
    Or is there another way to format the text field (besides typing today's date) to get the current date?
    Thanks.
    Ali
    using iMac 2.93 GHz Intel Core 2 Duo 8 GB | OS Snow Leopard 10.6.8 | Acrobat Pro 8

    Thank you GKaiseril!
    From the examples by Chris Dahl, I edited the script in the text field editing dialog to reflect the title I had given the field. That fixed the problem of today's date disappearing as soon as I tabbed to the next field.
    How do I choose for document level or page open script? I would like it to insert the date upon opening the document.
    Thanks again.
    Ali
    NOTE: I found the answer within Chris Dahl's tutorial... path is for Acrobat Pro 8: Advanced>Document Processing>Document Javascripts

  • Automatically Create Hyperlink Using Product Name in PDF text

    Hi,
    I've recently been told that all the product names in our PDF documents from here on out have to link to their component files (these are also PDF files) on our server (which is currently hosted locally). This is a problem because any given document is generated as a Solidworks Assembly engineering drawings. Before I try my first attempt at creating an Indesign Script (on something that sounds kind of complicated for a novice like me) I was wondering if there are any existing scripts out there that do something like the following:
    Find all instances in the text of product names beginning in 3 capital letters and ending in a number (digit)
    Create a hyperlink to the component parts files using the product name found in the text. Taking the product name--CAI623, for instance--and creating a hyperlink
    So the end result, for example, would be that a product name like CAI623 would become a hyperlink and would open the component part file like CAI623-1
    It seems like it might be a relatively common problem, so I'm hoping that someone out there may have a resource already available. Oh, I'm on Indesign CS5 on a PC. Would prefer Javascript so our vendors could use it on a Mac. If not, I'll get to crackin' on making it myself.
    Thanks in advance for any pointers!

    I wrote a few similar scripts. If you're interested, give me your e-mail via PM.
    Kas

  • Why Acrobat 9.5.5 Pro scrambles PDF text print, OSX.10.2?

    As I'm getting ready to meet with City officials I am unable to print my material and the only option I have is to post a question on a forum, this is just wrong. If I was told to buy an update I would, happily, but I have no idea if that would fix the problem. Thanks, Adobe.

    Hi,
    This is not happening because of Acrobat update but the reason for this change is that Firefox 19.0 has introduced  its own Javascript PDF viewer.
    You can change the settings in browser to use Acrobat plugin for viewing PDF files. Go to Options->Application to chnage the settings, please see attached screenshot for more details.
    Hope this solves your problem.
    Thanks.

  • Cp4 AS3 - using Javascript to generate a text string

    I'm a complete Javascript beginner, so please forgive me if this is a stupid question!
    I need to generate a pseudo random text string. I'm using the unpatched version of Cp4, AS3, Internet Explorer 7
    I've had a look at Captivate.Dev.com and the w3schools site to try to understand how to pass variables & basic javascript, and this is what I've come up with:
    var objCP = document.Captivate;
    function GenerateCode(){
    var rngen = new Array(8);
    var tgits = new Array(8);
    var cdrtn="";
    var lpdx=0;
    var mulier=1;
    for (lpdx=0;lpdx<=5;lpdx++){
    rngen[lpdx]=(Math.floor(Math.random()*9)+1);
    mlier=mulier*(rngen[lpdx]);
    tgits[lpdx]=rngen[lpdx]+"";
    cdrtn=cdrtn+tgits[lpdx];
    rngen[6]=(mlier%17)%10;
    rngen[7]=(mlier%13)%10;
    for (lpdx=6;lpdx<=7;lpdx++)
    tgits[lpdx]=rngen[lpdx]+"";
    cdrtn=cdrtn+tgits[lpdx];
    objCP.cpEISetValue('MyJavascriptVariable', cdrtn);
    GenerateCode();
    I've created a user variable called MyJavascriptVariable , put the code above in the On Slide Enter, Execute Javascript window on the first slide, and on the second a simple caption box showing the variable contents.
    However, when I press F12 I get an orange playbar at the top of the window, and in the middle the preloader and the captionbox (without the return value) flickering. i.e. classic sign of wrong AS version.
    If I change to AS2 the movie progresses ok, but the value the caption reports back for MyJavascriptVariable is blank.
    I know my core code works correctly - if I use the w3school's tryit editor with the code after the function declaration up to the closing curly before the objcCP line, with an addeded document.write to show the variable it works fine.
    It's clearly something to do with the way I'm declaring/passing the function or the way Cp runs the javascript. But what?
    Any help greatfully appreciated!
    Thanks

    Hi Jon,
    You are right... it works great on the W3Schools site.  Although in Cp, you ran into quite an issue using the modulus operater (%).  Looks like Cp needs the encoded version of this operator which is (%25).  Also, if you're using Cp4, then when you go to set the caption, you want to use objCP.cpSetValue();  Cp5 uses cpEISetValue.  I also try to use single quotes when working with strings.
    Here's the updated code:
    var objCP = document.Captivate;
    function GenerateCode() {
    var rngen = new Array(8);
    var tgits = new Array(8);
    var cdrtn='';
    var lpdx = 0;
    var mulier=1;
        for (lpdx=0; lpdx<=5; lpdx++){
            rngen[lpdx]=(Math.floor(Math.random()*9)+1);
            mlier=mulier*(rngen[lpdx]);
            tgits[lpdx]=rngen[lpdx]+'';
            cdrtn=cdrtn+tgits[lpdx];
    rngen[6]=(mlier %25 17) %25 10;
    rngen[7]=(mlier %25 13) %25 10;
       for (lpdx=6; lpdx<=7; lpdx++){
            tgits[lpdx]=rngen[lpdx]+'';
            cdrtn=cdrtn+tgits[lpdx];
    objCP.cpSetValue('MyJavascriptVariable', cdrtn);
    GenerateCode();
    This looks like some really crazy math.
    Let me know if this helps.
    Jim Leichliter

  • Using javascript to make a text box invisible by clicking a radiobutton

    hi
    my radiobuttons are for a persons title eg Mr Miss Mrs Ms and value 5 is for other.
    when i click other i want a text box to appear that a user can write in, and if the user changes their mind after writing in the box i want the text box to disappear
    you may of noticed i am new to java. this is the code i have used for my text box
    topmostSubform.Page1.titleother::calculate - (JavaScript, client)
    if (titlebox.rawValue == 5)
    this.presence = "visible";
    else
    this.presence = "invisible";
    this.rawValue;
    i have tried variations of this script but it still doesnt work the way it should. i tried searching forums and help files but couild not find an answer to this simple problem... can anyone help

    thnaks for your post thomas i appreciate your help on this :)
    yes it did put 'other' in my text box.
    i managed to overcome the proble using a workaround, it isnt ideal but it works. i put a clickevent in the radiobuttons and changed the text box from calculated to optional

  • Selecting which version of Acrobat to use when opening a pdf

    I have a user who has Acrobat 5, 6, & 7 installed on his 10.3 system (don't ask me why - he just does).
    If you do a GetInfo on a .pdf document, Acrobat 5 is listed as the default (which is what he wants).
    However, if he uses Safari and clicks on a link to a .pdf document, it opens the document (in Safari) using Acrobat 7. He wants it to open the document external to Safari using Acrobat 5.
    How can he set this (there doesn't seem to be a setting to control it).?

    I did see another thread on how to disable the plugin:
    Trash the file /Library/Internet Plug-Ins/AdobePDFViewer.plugin and restart Safari.
    This did exactly what I was looking for.

  • Rotating pages in in Acrobat Reader using Javascript + AIR

    Greetings,
    Currently we're building an application to view pdf files in an AIR application.
    We communicate with a javascript code, embedded in the PDF.
    Now, we want to rotate the pages of the document, but we cannot get this to work...
    Zoom, page up, page down, those work fine,
    but when we try to set the rotation for the pages, nothing happens.
    We also found rumours that rotating pages won't work in Acrobat Reader 9, but we need to be sure.
    all the help is appreciated!
    Regards,
    Mario
    //-----------------Do not edit the XML tags--------------------
    //<Document-Level>
    //<ACRO_source>0000000000000000</ACRO_source>
    //<ACRO_script>
    /*********** belongs to: Document-Level:0000000000000000 ***********/
    function myOnMessage(aMessage)
        if (aMessage.length==1)
            app.alert(aMessage[0]);
            switch(aMessage[0])
                case "ZoomIn":
                    zoom *= 2;
                    break;
                case "ZoomOut":
                    zoom /= 2;
                    break;
                case "PageUp":
                    pageNum--;
                    break;
                case "PageDn":
                    pageNum++;
                    break;
                case "rotateClockWise":
                    app.alert("rotating, rotating, rotating...rawhiiddde!!");
                    this.setPageRotations(0,1,90);
                     app.alert("rotated?");
                    break;
                case "pageFit":
                    zoomType = zoomtype.fitP;
                    break;
                case "pageWidth":
                    zoomType = zoomtype.fitW;
                    break;
                default:
                    app.alert("Unknown message: " + aMessage[0]);
        else
            app.alert("Message from hostContainer: \n" + aMessage);
    function myOnDisclose(cURL,cDocumentURL)
        return true;
    function myOnError(error, aMessage)
        app.alert(error);
    var msgHandlerObject = new Object();
    msgHandlerObject.onMessage = myOnMessage;
    msgHandlerObject.onError = myOnError;
    msgHandlerObject.onDisclose = myOnDisclose; this.hostContainer.messageHandler = msgHandlerObject;
    //</ACRO_script>
    //</Document-Level>

    We also found rumours that rotating pages won't work in Acrobat Reader 9, but we need to be sure.
    A product with the name 'Acrobat Reader 9' doesn't exists.
    With Adobe Acrobat you can rotate pages. Read the documentation in the Acrobat Javascript Reference.

  • Scroll() in Adobe Acrobat and Adobe Reader X using Javascript

    Hi there,
    Does someone know how scrolling works in Adobe Acrobat/Reader using javascript?
    The scroll() functions needs two parameters: x and y.
    How are these axises defined? Is this based per page or does the scrolling reference change every time the page changes?
    Why we need to know this? We're making and application in Flash Builder that loads a PDF. External buttons need to call an embedded javascript within the PDF that scrolls up or down.
    Anyone who can provide us with some information concerning this topic: thank you!
    Regards
    Mario

    Well,
    It's hard to formulate: basically we need to understand how the scrolling is handled in Adobe Reader.
    Like: why does the scrolling index change every time you change to a new page. It gets resetted or something.
    Anyway: you cannot create a variable "scrollVerticalIndex" and "scrollHorizontalIndex" and increment it everytime you want to go down or up/left or right and say scroll(scrollHorizontalIndex,scrollVerticalIndex). Also, if you zoom in, the dimension of your page stay the same. We cannot find a way to calculate top or bottom of a document.
    In a perfect world you could say: (height of a page) x ((number of pages)-1) = total height of the document (and thus the total amount you can scroll up/down). But that is just not the case...
    We want to get an insight how the scrolling works :-)
    Does this make sence ;-) ?

  • How to manipulate pdf files using javascript in action wizard

    Respected all ,
    I am a software programmer from india and i want to make a programe which can do below described things :
    I want to know that how can i achive this kind of steps using javascript in acrobat XI :
    for ex. if i have  4 pdf files :  800123-001.pdf , 800123-002.pdf    and  800555-001.pdf , 800555-002.pdf
    then i want to do using javascript
    step 1 :  pdf to ps , output should be : 800123-001.ps , 800123-002.ps , 800555-001.ps , 800555-002.ps
    step 2 : ps to pdf (acrobat distiller ) : 800123-001.pdf  , 800123-002.pdf , 800555-001.pdf , 800555-002.pdf
    step 3 : pdf merge : 800123.pdf  - > which contains both : 800123-001.pdf and 800123-002.pdf
                   and                     800555.pdf -> which contains both : 800555-001.pdf and 800555-002.pdf
    ----------END------------
    Is it possible using javascript in acrobat or any other way ?

    i can not access adobe site .. can you plz replay me on my personal e
    mail.. [removed personal contact info, please send a forum message instead]
    On Wed, Jun 19, 2013 at 1:16 AM, Test Screen Name
    Message was edited by: sinious

  • Possible to save files in My Documents using JavaScript?

    I have a customer who wants his users (service technicians) to be prompted to save a PDF form they fill out, print, and sign for their customers. It's easy to set the File>Save As action for the form button, but my customer wants to know if it's possible to always have the form saved to My Documents.
    I've searched the form and haven't been able to find any discussion on this. I can't imagine how to do it, since My Documents is inside the user profile... but was wondering what people who actually know what they're talking about (as opposed to me, that is) might have to say.
    If it is possible to do what my customer wants, can you point me to any existing code or reference sources?
    Cheers!
    ---Fox

    But I have two problems with this...
    The first is that I ran several Google site-searches and Adobe searches, but did not find any document*** named Acrobat JavaScript API Reference, even though it is also directly referenced in the Acrobat 9 help (listed there as JavaScript™ for Acrobat® API Reference, but I've searched using broader terms such as API reference and other combinations, and it simply did not come up).
    I did find the companion "Developing Acrobat® Applications Using JavaScript". But it's overwhelming, and I don't know what chapter(s) contain the information I need to throw together a proper working script for what I need.
    That's the other problem.
    I do not know JavaScript. I know how to include it but not how to write it. Everywhere I look, the blanket response to newbie JavaScript questions is to dump the wad of documentation in the asker's lap, expecting them to sit down and read it "cover to cover."  I now have a long-overdue project and I need help, fast. I don't have time to learn JavaScript from scratch! -- If I did, I wouldn't be asking these questions! I'd be figuring it out myself.
    This is becoming very frustrating. Won't somebody please help me out, or tell me exactly what pieces of code I need to put in and where I need to put it?  I can at least go look up the syntax, as long as I know what to look for.
    EDIT:  *** Now that I've written that, I ran the Adobe search tool again and found the PDF version, which is what I was looking for. The saveAs samples make no sense to me, and I keep trying to dig back through the documentation to figure out what the heck it's talking about. It's a quagmire. The documentation is barely understandable; it's very poorly worded, and every sentence is thick with unfamiliar concepts for a n00b -- and I'm a tech writer!
    Message was edited by: FoxCole

  • Can I open pdf on the web if the link is javascript:viewpipdf(123.pdf)?

    Example: http://www.tntb.gov.tw/core/eng/endownload.php?page=2
    Question: The above website using javascript for download pdf files, how can i config my adobe reader X / Plugin to open it directly?
    Browser : Mozilla Firefox
    Add-on: download statusbar, IE Tab2
    Plugin: Adobe Acrobat 10.0.1.434
    Thanks a lot!!

    I just tried that and its still not working.
    Thanks for the suggestion though :-)

Maybe you are looking for