Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF

TOPIC:

Compiling PDF forms 9 years 6 months ago #7230

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
have you any screen shot?
i guess the clipped text are out of edit border.

Please Log in or Create an account to join the conversation.

Compiling PDF forms 9 years 6 months ago #7231

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
it seems works fine in demo project, as below operations:
1. edit text field, and type some words, then exit editing.
2. edit the text field again, then exit editing.
3. click "save" button.
4. click "close" button.
5. reopen the PDF file again, the text shows fine.
NOTICE: do not type long texts out of text border.(means do not type text cause text-box to be scroll)

Please Log in or Create an account to join the conversation.

Last edit: by .

Compiling PDF forms 9 years 6 months ago #7235

  • noberasco
  • noberasco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 48
  • Thank you received: 0
Hi,

here are the screenshots (from within my own application):
1) dl.dropboxusercontent.com/u/7172743/Screenshots/screen.png
2) dl.dropboxusercontent.com/u/7172743/Screenshots/screen2.png
3) dl.dropboxusercontent.com/u/7172743/Screenshots/screen3.png

Screenshot 1 depicts my document just after entering a value in the text field. you see the same when exiting and reentering the document.
Screenshot 2 depicts my document just after editing the same text field again.
In screenshot 3 I just closed and reopened the document, without changing it any further.

As you can see, text in screenshot 3 is just weird, as it only displays a portion of the supposed text.
If, at this point, I tap and re-edit the same field, while editing I see the full value.

Please Log in or Create an account to join the conversation.

Compiling PDF forms 9 years 6 months ago #7237

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
it is really strange.
here is my test result:
first edit

second edit

save and reopen.


here is result PDF file:
www.radaee.com/files/edited.pdf

Please Log in or Create an account to join the conversation.

Compiling PDF forms 9 years 6 months ago #7238

  • noberasco
  • noberasco's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 48
  • Thank you received: 0
In order to also let you understand what I'm doing, here follows a (simplified) version of the source code in question.
public void OnAnnotClicked(PDFVPage vPage, final Page.Annotation annotation) {
	if (annotation.GetFieldType() == 2) {
		int     editType   = annotation.GetEditType();
        int     maxLen     = annotation.GetEditMaxlen();
        boolean singleLine = (editType != 3);

        Log.w("Siemens PDF", "Free text annotation has type " + editType + " and max len " + maxLen);

        final EditText    input  = new EditText(this);
        final AlertDialog dialog = new AlertDialog.Builder(this)
                .setTitle(annotation.GetFieldFullName())
                .setView(input)
                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        Editable value     = input.getText();
                        String   fieldName = annotation.GetFieldFullName();
                        String   newValue  = value.toString();

                        m_reader.PDFEndAnnot();
                        annotation.SetEditText(newValue);

                        if (m_doc.CanSave() == true) {
                            m_doc.Save();
                        }

                        m_reader.PDFRedrawPage(vPage);
                    }
                })
                .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        // Do nothing.

                        m_reader.PDFEndAnnot();
                    }
                })
                .setOnCancelListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialogInterface) {
                        m_reader.PDFEndAnnot();
                    }
                }).create();

        input.setText(annotation.GetEditText());
        input.setSelection(input.getText().length());
        input.setSingleLine(singleLine);

        if (maxLen > 0) {
            input.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLen)});
        }

        input.setImeOptions(input.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);

        input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();

                    return true; // consume.
                }

                return false; // pass on to other listeners.
            }
        });

        dialog.show();
	}
}

Please Log in or Create an account to join the conversation.

Compiling PDF forms 9 years 6 months ago #7239

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
i not know what this happen.
now you can try:
modify Global.Init()
where
		// set text font for edit-box and combo-box editing.
		if (!setAnnotFont("DroidSansFallback") && face_name != null) {
			setAnnotFont(face_name);
		}
change to:
		// set text font for edit-box and combo-box editing.
		if (!setAnnotFont("Roboto-Regular") && face_name != null) {
			setAnnotFont(face_name);
		}
just try it.

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum