Form fields are not shown in the converted xod which has special characters

52 views
Skip to first unread message

muraleek...@multunus.com

unread,
Jul 20, 2016, 8:27:00 PM7/20/16
to PDFTron PDFNet SDK
We are using PDFNet::Convert module to convert the pdf with form to xod and later using the xod in the pdf viewer to render the form in the mobile viewer. When we try to respond to the form, certain field are not rendered at all.

The flow is as given.
1. The pdf with form is uploaded to the server 
2. Server converts the pdf to xod and saves it in the file store
3. The saved xod is fetched by the mobile and rendered in the webviewer 
4. User responds to the fields and send back the xfdf data to the server 

 
var contentWindow = frame.contentWindow,
 annotationManager
= contentWindow.readerControl.docViewer.getAnnotationManager(),
 formData
= annotationManager.exportAnnotations();
 updateFormDataInServer
(formData);


5. Server accepts the xfdf and escapes the form special characters so that postgresql can save it as xml
#custom attribute setter
def update_form_data(form_data, user_id)
        normalized_form_data
=  REXML::Text.normalize(form_data)
        update
(form_data: normalized_form_data, updated_by_id: user_id)
end

6. User views the form fetched
Server:
# model getter
def form_data
   normalized_form_data
= read_attribute(:form_data)
   REXML
::Text.unnormalize(normalized_form_data) unless normalized_form_data.nil?
end

Client:
$(document).on('documentLoaded', function() {
 
var docViewer = readerControl.docViewer;
 docViewer
.setInternalAnnotationsTransform(function(originalData, callback) {
 
var customData = (window.ControlUtils.getCustomData()) || originalData; //customData is xfdf saved in the server, use it if available else use the pristine form data
 callback
(customData);
 
});
});

7. The updated field values are absent along with some other fields/widgets.


A thorough inspection of the html obtained in 3rd step shows all the field/widgets missing from the rendered pdf. Only the background image is visible. 

Ryan

unread,
Jul 21, 2016, 4:11:57 PM7/21/16
to PDFTron PDFNet SDK
Thank you for the detailed report.

Do you know what transformations the REXML normalizer is doing? XFDF has to be in UTF8 encoding (the standard only supports UTF8), so before importing back into WebViewer, it needs to be returned to UTF8 encoding.

If that doesn't help then we would need the XFDF data as it is just before importing into the annotationManager.

If you can't post here, please send it to support.


Reply all
Reply to author
Forward
0 new messages