Retreiving and setting fields from pdf

Hi Everyone,
I hope that you may be able to help. I'm working on putting together an extention to my program to allow users to load a pdf file from a database, and also save what the user has entered into the pdf, into a database. I started out using the ActiveView sample app and have gotten it to load a seleted pdf into my app. I am currently trying to get the fields from the pdf. I am using the FormsAutomation sample as a reference. Here is some code :
This funtion is used to open the pdf (just like in the ActiveView sample)
    Public Sub OpenChartFile(ByRef Filename As String, PatientId As String, ChartId As Integer, isNew As Boolean )
        Dim ok As Integer
        Dim fIndex As Short
        ' change mousepointer to an hourglass
        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
        ' change form's caption and display new text
        fIndex = FindFreeIndex()
        Document(fIndex) = New frmPDFView
        Document(fIndex).PatientId = PatientId
        Document(fIndex).ChartFileId = ChartId
        Document(fIndex).ChartFileName = Filename
        Document(fIndex).isNew = isNew
        Document(fIndex).Tag = fIndex
        Document(fIndex).Show()
        Document(fIndex).Text = UCase(Filename)
        Document(fIndex).MdiParent = gShell
        ' open the selected file
        AcroExchAVDoc(fIndex) = CreateObject("AcroExch.AVDoc")
        ok = AcroExchAVDoc(fIndex).OpenInWindowEx(Filename, Document(fIndex).Handle.ToInt32, AV_DOC_VIEW, True, 0, PDUseBookmarks, AVZoomFitWidth, 0, 0, 0)
        ' See IAC.bas and the Acrobat Viewer IAC Overview for information on the
        ' OpenInWindowEx open modes
        If Not ok Then
            MsgBox("Can't open file: " + Filename)
            Document(fIndex).Close()
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
            Exit Sub
        End If
        FState(fIndex).Dirty = False
        Document(fIndex).Show()
        Document(fIndex).FillChart() 'Used to fill the pdf from the DB
        ' reset mouse pointer
        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
    End Sub
Here is were I try and get the fields which is located in the PDFView form
    Public Sub FillChart()
        If Not pisNew then
            formApp = CreateObject("AFormAut.App")
            acroForm = formApp.Fields  '<-----******Errors here, "No document is currently open in the Acrobat Viewer"
            FillChartData( pPatientId,acroForm,pChartFileId, Me.tag )
        End If
    End Sub
Here is where I plan to fill the pdf file (Located in a module file): I
Public Sub FillChartData(PatientId As string, acroForm As AFORMAUTLib.Fields, ChartFileId As Integer, FormIndex As integer )
    Dim field As AFORMAUTLib.Field
Try
    field = acroForm.Item("PatientName")
Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Critical, "ModChartSupport.FillChartData")
End Try
End Sub
Is it possible to get the list of fields in the current setup using the ActiveView forms? If so, what am I missing? In the FormAutomation sample it seems to get the fields this way:
        avDoc = CreateObject("AcroExch.AVDoc")
        Dim file As String = System.Windows.Forms.Application.StartupPath & "\..\..\..\..\TestFiles\FormsAutomation.pdf"
        bOK = avDoc.Open(file, "Forms Automation Demo")
        'If everything was OK opening the PDF, we now instantiate the Forms Automation object.
        If (bOK) Then
            formApp = CreateObject("AFormAut.App")
            acroForm = formApp.Fields
        Else
            System.Runtime.InteropServices.Marshal.ReleaseComObject(avDoc)
            avDoc = Nothing
            MsgBox("Failed to open PDF Document. Aborting...")
            End
        End If
The OpenChartFile function has already created the avDoc object for the form, so I think I'm alright there. What am I missing? Thanks for any help you can provide.

So let's say you have the following fields in your file:
Incident_Report
ClientsName
Date
You can then add this code to the file's WillSave action (under Tools - JavaScript - Set Document Actions):
var newFileName = this.getField("Incident_Report").valueAsString + "_" + this.getField("ClientsName").valueAsString + "_" + this.getField("Date").valueAsString + ".pdf";
app.response("Please copy the text below and use it as the new file-name:","", newFileName)
Of course, you can adjust the message to the user, and even the format of the file-name, although I've used the format you specified.

Similar Messages

  • Copy all fields from pdf to word

    copy all fields from pdf to word

    Try using shift/apple/4 - gives you a cross-hair selector to grab part of the screen - saves as Picture1.png to your Desktop then drag that into Word.
    Or, /Utilities/Grab

  • Need to get the values from "Signed" field from PDF form.

    Hi,
    This is Dinesh. I am PHP Developer. My issue is "I am not able to get the value of "signed" field from the PDF form when the form has been submitted.". I want to get the Digital Signature value of that field and i need to store it in the DB.
    Please help me here Or Please forward this issue to any of the PHP developer who solved this issue and let me know.
    Thanks & Regards
    Dinesh

    Hi Vikas,
    you can use this badi MRM_WT_SPLIT_UPDATE, the method will be WHTAX_SPLIT_UPDATE
    in this badi please see the importing and exporting parameters, you will get the  values of withholding tax code  as TE_RBWS in export parameters.
    Please search in google or SCN you will get how to use it.

  • Reading UI mode and setting field mode in WebUI

    Hi
    Just getting into crm and I have some questions.
    How do I determine if a UI view is in create or change mode?
    How can i change a fields from input fields to display fields?
    The reason is I need to close 2 fields for input on the screen in change mode. But they need to be open i Create mode. It is the same view that is used for Create and Edit mode.
    Hope you can hint me in the right direction.
    Sonny

    Hi,
    I suppose you are asking for ABAP statements.
    How do I determine if a UI view is in create or change mode?
    data: lv_displaymode type abap_bool.
    lv_displaymode = view_group_context->is_view_in_display_mode( me ).
    How can i change a fields from input fields to display fields?
    view_group_context->set_view_editable( ).
    If the view groupcontext is not used, you can set the state manually on the HTMLB tags on the .htm page.
    Finetuning can be done in the GET_I methods of the context node.
    cheers Carsten

  • Preview - Cannot copy and paste text from pdf

    Hi there ...
    I usually have no problem copying and pasting text from a pdf using Preview ...
    However .. I recently received a pdf ... and there is no way it will highlight the text to copy ...
    The older pdf's are not affected ...
    I did a get info on the pdf ... it's not locked ... and it was made by Adobe In Design CS2
    I tried opening it with Adobe Reader 9 ...... but still no luck
    IN my search .. I noticed one other person had the same problem ... but he didn't get any responses..
    Thanks for any info ....

    If it's behind something else then you can open it in Illustrator and select the specific object you want. If it's rasterized then no.
    If this is a document you can share with the world then I'm sure we could tell you what specifically is going on if you posted it here.

  • How to keep the input field from PDF Form to RTF

    Hi,
    I'm looking to keep the input fields from my pdf form document to Rtf so I can use them in my Rtf document.
    Regards,
    Alan

    Good day Alan,
    I'm afraid that's not possible as form fields in a PDF file have no equivalent either in a Word format (.docx/.doc) or within the Rich Text Format (.rtf).  That data is simply stripped during the conversion as there's no equivalent available.
    Kind regards,
    David
    Acrobat Community Manager
    Adobe Systems

  • Copy and paste image from PDF to another application

    how do you copy and paste an image from PDF into another application such as Word or Excel? I know how to copy>> hover cursor over picture until it turns into a select "+" tool, select and right click to copy but when I try to paste it into another application, its loses all of its formatting. Thanks

    Not sure what you mean by formatting of a picture. You can export all images and get a files to import to word. You can also use the snapshot tool, though it captures a screen copy. If you select an image and copy, my experience has been that it will only copy to PhotoShop, but it is not something I do very much. If the image is part of the document (not markup like a stamp or such), you can use the select tool to select the image and copy it to the clipboard. Just tried it and it worked fine. If it is a stamp (like pasted in), then you can not copy it in this way, if at all.

  • Read and Get Data from PDF

    Hi All,
    I am fairly new to programming macros in Excel VBA, and right now I need to write a macro that can open a PDF file and read it and get data from there and paste it into an excel spread sheet. Is this possible?  If so can you give me some sample code
    that would do that?

    I did this once many years ago.  I had to have Acrobat Professional installed ($$$).  There are free pdf parsers that you access from VBA using Win32 commands like:
    https://code.google.com/p/peepdf/
    Maybe something has changed since I did it

  • How can I eliminate prefix and suffix fields from Apple Contacts?

    Apple Contacts has a terrible system that adds "Mr" or "Ms" in front of every name in my contacts and sometimes a suffix.  This is a truly bad feature.  There must be some way to eliminate these fields from Contacts.  How can the prefix and suffix fields be eliminated from Contacts?

    This might help: http://support.apple.com/kb/HT1495.

  • How to store ,retreive and edit  data from an xml file

    I am new to XML. I am creating a phone book in JSP with backend as an XML file.How can I store retrieve and edit datas from a jsp file.
    Please provide me with examples.I dont want to use bean.
    Please provide examples

    You will have to do some leg-work yourself. You will probably want to use DOM to parse and manipulate your XML data. Xerces (xml.apache.org) is a good open source parser. There are extensive examples on their site.
    - Saish

  • Reading and extracting information from pdf file

    Hi everybody!
    what am looking for is Java packages which can allow me to read and extract information form pdf file
    I would really appreciate link wtih sample code
    thanks in advance!

    STFW.
    http://www.google.com/search?q=java+read+pdf&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8

  • I have downloaded the converter program and the conversion from PDF to Word is terrible. Is there a better solution or setting?

    I am trying to convert a PDF to Word without re-typing.  I downloaded the converter program onto my MAC but the conversion was terrible.  Unusable.  Is there a better way.  I also have a PC so I could try that as well if would make any difference.

    "Scanned"  Scanned anything starts you with an image / picture of the page content that was on the source paper.
    There is no "renderable" text. OCR can provide an output of text that can be exported. Without that all that is exported is the image.
    As to OCR, Acrobat's ClearScan lends itself to repurpose via the export process.
    Regardless, anything sourced from a scanner output is the "pig's ear" and that'll not yield the "silk purse".
    Export is dictated by the input (GIGO). Export output identifies input quality.
    As a C Student stated a Word file (being well-built helps) that sourced the PDF will yield workable export back to Word.
    PDF's sourced for FrameMaker export rather nicely.
    For optimal export always start with a well-formed Tagged PDF (ISO 14289-1, PDF/UA-1 compliant).
    Two core design considerations of tagged PDF are (1) support Accessible PDF and (2) support export (repurpose) of PDF content. 
    Be well...

  • Problems using window.close() and setting fields

    Hi,
    I have two problems:
    First one is:
    I created a simple JSP with 'Save' and 'Exit' Buttons. In the Exit button on click event I invoked a function closeWindow, which calls teh window.close(). But on clicking Exit, the window does not close. Can anyone please tell me why.
    Second one is:
    The JSP also needs to get loaded with some values in the Textfields. Theses values are extracted from a text field using a Java class. I am able to see that these values are extracted from the text file and are loaded into Java vars, but when I am trying to set this value into a text field, it is NOT getting set.
    (filePathDetails is the instance of the class that extracts the text values)
    The entire code is posted below:
    <%@ page language="java" import="ftpScheduler.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <% FolderPathInfo filePathDetails = new FolderPathInfo(); %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>PATH DETAILS</title>
        <SCRIPT type="text/javascript">
         function setPaths(){
              with(document.pathDetails){
                   textAncPath1.value = <%=filePathDetails.localDirPath1 %>;
                   textAncPath2.value = <%=filePathDetails.localDirPath2 %>;
                   textArchivePath.value = <%=filePathDetails.archiveDirPath %>;
                   textLogPath.value = <%=filePathDetails.logFilePath %>;
         function closeWindow(){
              window.closeWindow();
        </SCRIPT>
    </head>
    <body bgcolor="#c0c0c0" onload="setPaths()">
         <FORM name="pathDetails" method="get" action="DetailsServlet.java">
         <FONT face="Arial" size="3"><STRONG>Directory Paths:</STRONG></FONT>
           <BR><BR>
           <TABLE border="0" cellspacing="" height="60" width="450"
                                                        style="FONT-SIZE: 10pt; FONT-FAMILY: Arial" align="center">
           <COLGROUP>
           <COL width="45%">
           <COL width="55%">
           </COLGROUP>
           <TR>
           <TD><LABEL>Ancillary Transmit Path1 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath1" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Ancillary Transmit Path2 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath2" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Archive Path :</LABEL></TD>
           <TD><INPUT type="text" name="textArchivePath" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Log File Path :</LABEL></TD>
           <TD><INPUT type="text" name="textLogPath" width="290" maxlength="350"/></TD>
           </TR>
           </TABLE>
           <P align="center">
              <INPUT type="submit" name="buttonSave" value="Save">
              <INPUT type="button" name="buttonExit" value=" Exit " onclick="closeWindow()">
              <BR>
           </P>
           </FORM>
    </body>
    </html>Please help me.
    Thanks in advance.

    Try the following..
    For problem 1:
    Use window.close() instead of window.closeWindow().
    For the second problem
    don't call the function setPaths() at onload. Rather
    call the function after the page is loaded. You can
    try like this.
    If it doesn't work then check whether the browser is
    giving any JavaScript error message.
    <SCRIPT type="text/javascript">
    setPaths() ;
         function setPaths(){
         alert(document.pathDetails.element[0].value);
    document.pathDetails.element[0].value =
    = <%=filePathDetails.localDirPath1 %>;
              alert(document.pathDetails.element[0].value);
              with(document.pathDetails){
    textAncPath1.value =
    e = <%=filePathDetails.localDirPath1 %>;
    textAncPath2.value =
    e = <%=filePathDetails.localDirPath2 %>;
    textArchivePath.value =
    e = <%=filePathDetails.archiveDirPath %>;
    textLogPath.value = <%=filePathDetails.logFilePath
    ath %>;
         function closeWindow(){
              window.closeWindow();
    </SCRIPT>Hi,
    Actually I did try window.close(), but I still am not able to close the current window.
    And as for the problem of setting up the field values, sorry the given solution doesnt seem to work. :-(..
    I have pasted the entire code, I dont know where teh flaw is. Please review the same and let me know.
    Your help is very much appreciated.
    <%@ page language="java" import="ftpScheduler.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <% FolderPathInfo filePathDetails = new FolderPathInfo();%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>PATH DETAILS</title>
         <SCRIPT type="text/javascript">
         function setPaths(){
              document.pathDetails.textAncPath1.value = "Anything";
              with(document.pathDetails){
                   textAncPath1.value = <%=filePathDetails.localDirPath1%>;
                   textAncPath2.value = <%=filePathDetails.localDirPath2%>;
                   textArchivePath.value = <%=filePathDetails.archiveDirPath%>;
                   textLogPath.value = <%=filePathDetails.logFilePath%>;
         function exitWindow(){
              window.close();
        </SCRIPT>
    </head>
    <body bgcolor="#c0c0c0">
         <FORM name="pathDetails" method="get" action="/FTPSchedulerApp/ftpScheduler/DetailsServlet.java">
         <FONT face="Arial" size="3"><STRONG>Directory Paths:</STRONG></FONT>
           <BR><BR>
           <TABLE name="tempTable" border="0" cellspacing="" height="60" width="450" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial" align="center">
           <COLGROUP>
           <COL width="45%">
           <COL width="55%">
           </COLGROUP>
           <TR>
           <TD><LABEL>Ancillary Transmit Path1 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath1" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Ancillary Transmit Path2 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath2" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Archive Path :</LABEL></TD>
           <TD><INPUT type="text" name="textArchivePath" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Log File Path :</LABEL></TD>
           <TD><INPUT type="text" name="textLogPath" width="290" maxlength="350"/></TD>
           </TR>
           </TABLE>
           <div align="center">
              <INPUT type="submit" name="buttonSave" value="Save"/>
              <input type="reset" name="buttonReset" value="Reset" onclick="setPaths()"/>
              <button name="buttonExit" onclick="exitWindow()"> Exit </button>
              <BR>
           </div>
           </FORM>
    </body>
    </html>

  • Using Fields from PDF when saving

    Im looking on how to use fields in a pdf form when saving the form.
    ex. Incident Report
    Staff open up the form. Put in the information. Want it so when they save it puts the clients name and date in the save as. So they open Incident_Report.pdf when they save it would be Incident_Report_ClientsName_Date.pdf Yes the staff could type that in that way but want to make it as easy for everyone involved.

    So let's say you have the following fields in your file:
    Incident_Report
    ClientsName
    Date
    You can then add this code to the file's WillSave action (under Tools - JavaScript - Set Document Actions):
    var newFileName = this.getField("Incident_Report").valueAsString + "_" + this.getField("ClientsName").valueAsString + "_" + this.getField("Date").valueAsString + ".pdf";
    app.response("Please copy the text below and use it as the new file-name:","", newFileName)
    Of course, you can adjust the message to the user, and even the format of the file-name, although I've used the format you specified.

  • Prefixed XMLNS and exported XML from PDF

    I have the following XSD sample:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://www.irs.gov/efile" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.irs.gov/efile" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
    <xsd:annotation>
      <xsd:documentation>
      </xsd:documentation>
    </xsd:annotation>
    <xsd:include schemaLocation="efileTypes.xsd"/>
    <!-- ===================================  ATTACHMENTS TO MESSAGES  =================================== -->
    <!-- IRS Submission Manifest -->
    <xsd:element name="IRSSubmissionManifest">
      <xsd:complexType>
       <xsd:sequence>
    I am importing the XSD file into Designer and generating all possible fields. I include a button to generate XML output using Acrobat. When I load the PDF into Acrobat and generate the XML, I want the following result:
      <IRSSubmissionManifest xmlns="http://www.irs.gov/efile" xmlns:efile="http://www.irs.gov/efile">
    However, no matter how I edit the XSD, I can only generate the following result:
    <IRSSubmissionManifest xmlns="http://www.irs.gov/efile">
    How do I get the " xmlns:efile="http://www.irs.gov/efile" " fragment to appear in the IRSSubmissionManifest element?
    Thank you.

    Thanks again for your help.
    I tested your code as-is on a webpage for testing XLST, and when I gave it some sample XML data it returned all the element content with the element tags removed. The sample data is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <IRSSubmissionManifest xmlns="http://www.irs.gov/efile"><SubmissionId>2</SubmissionId><EFIN>123456</EFIN><TaxYear>2011</TaxYear><GovernmentCode> IRS</GovernmentCode><FederalSubmissionType>1040</FederalSubmissionType><TaxPeriodBeginDate >20110101</TaxPeriodBeginDate><TaxPeriodEndDate>20111231</TaxPeriodEndDate><TIN>123456789< /TIN></IRSSubmissionManifest>
    I altered the fourth line of your XSLT to read as follows: <xsl:template match="IRSSubmissionManifest">
    I tested that XSLT on this page: http://xslttest.appspot.com/
    And the result was exatly what I needed.
    However, I since imported that XSLT into the PDF in Designer and the transformation doesn't occur. The generated XML has all element tags removed. I receive no error messages regarding the XSLT when I save the PDF file in Designer.
    So close yet not enough.
    I wonder if the XML export functionality doesn't like having the root element tag altered. Regardless, it doesn't seem like any of the data supplied is in error.

Maybe you are looking for