server FDFMerge() not successful with nested field structure pdfs

118 views
Skip to first unread message

Danny Mendel

unread,
Jun 10, 2016, 8:53:23 PM6/10/16
to PDFTron WebViewer
hi Matt,

i notice that my code

using (PDFDoc doc = new PDFDoc(pdf_file))
                            {
                                doc.InitSecurityHandler();
                                FDFDoc fdoc = new FDFDoc(FDFDoc.CreateFromXFDF(xfdf_file));
                                //fdoc.Save(fdf_file);
                                doc.FDFMerge(fdoc);
                                //doc.FlattenAnnotations();
                                doc.Save(pdf_file, SDFDoc.SaveOptions.e_linearized);
                            }

not working with several types of pdf (attached an example of "1.pdf/xfdf" pair which can not be FDF merged)
i don't get any error, but no form value are actually filled such as
<field name="fullname[0]">
            <value>גשדגדש</value>
        </field>
which should be,

my gut filling is that it has to do with the 2 level nested structure of field within parent field, perhaps pdftron 
doc.FDFMerge(fdoc); doesn't like Hierarchical stricture.

off course other forms such as form1.pdf are working as expected and you don't find any nested relatonship within its field, and perhaps also simplified field names...

let me know if you have any solution to make those work as well.

Many many thanks!
Danny

1.pdf
1.xfdf
nested field structure.png
form1.pdf

Matt Parizeau

unread,
Jun 13, 2016, 2:15:14 PM6/13/16
to PDFTron WebViewer
Hi Danny,

Could you repost this question in the PDFNet SDK forum here https://groups.google.com/forum/#!forum/pdfnet-sdk. You'll be able to get the answer from someone there faster!

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Danny Mendel

unread,
Jun 15, 2016, 9:07:04 PM6/15/16
to PDFTron WebViewer
i believe it has to do with exported xfdf elements missing via webviewer internal AltS / saveAnnotations() rather than server pdfnet not handling right merging.
i will try to send tomorrow an example consist of original pdf & xod , xfdf (with missing elements perhaps)  and final exported pdf
to show those missing such as arrows and/or free drawing 

thanks
Danny

Danny Mendel

unread,
Jun 16, 2016, 4:13:29 PM6/16/16
to PDFTron WebViewer
hi

here an example
1. opendoc.pdf - original file
2. opendoc.xfdf - original file annotations + 4 arrows i added via webviewer

<annots>
        <line subject="Line" page="0" rect="223.767167,751.333133,278.278165,789.005343" flags="print" name="5ac66878-e1b3-52f3-d678-35a9178a95c2" title="aaa" date="D:20160616215017+03'00'" color="#000000" width="0.75" opacity="1" creationdate="D:20160616215017+03'00'" start="224.52,752.08" end="277.53,788.26" head="OpenArrow" tail="None"/>
        <line subject="Line" page="2" rect="254.326448,761.311674,354.364539,792.747296" flags="print" name="302f641a-4624-7ec4-6b09-f2f1aa6ac69e" title="aaa" date="D:20160616215036+03'00'" color="#000000" width="0.75" opacity="1" creationdate="D:20160616215036+03'00'" start="255.08,762.06" end="353.61,792" head="OpenArrow" tail="None"/>
        <line subject="Line" page="2" rect="256.197425,784.387049,337.525751,804.596813" flags="print" name="9cf62161-cf34-237f-78a1-a2588b602304" title="aaa" date="D:20160616215036+03'00'" color="#000000" width="0.75" opacity="1" creationdate="D:20160616215036+03'00'" start="256.95,785.14" end="336.78,803.85" head="OpenArrow" tail="None"/>
        <line subject="Line" page="2" rect="225.638144,774.408509,285.138412,813.951695" flags="print" name="c8752689-c66d-a59f-5e75-284f961979c7" title="aaa" date="D:20160616215037+03'00'" color="#000000" width="0.75" opacity="1" creationdate="D:20160616215037+03'00'" start="226.39,775.16" end="284.39,813.2" head="OpenArrow" tail="None"/>
    </annots>

3. here is the export_opendoc.pdf result, as you can see instead of showing 4 arrows (one in page1, other three in page 3, it shows just single arrow)

this behavior of "missing" elements is consistent over different types of annotation types and with different varing base pdf files.

the merge code i used is trivial
if (System.IO.File.Exists(pdf_file))
                        {
                            using (PDFDoc pdfdoc = new PDFDoc(pdf_file))
                            {
                                pdfdoc.InitSecurityHandler();

                                if (System.IO.File.Exists(xfdf_file))
                                {
                                    using (FDFDoc fdoc = new FDFDoc(FDFDoc.CreateFromXFDF(xfdf_file)))
                                    {
                                        //fdoc.Save(fdf_file);
                                        pdfdoc.FDFMerge(fdoc);
                                        pdfdoc.FlattenAnnotations();
                                    }
                                }
                                pdfdoc.Save(export_file, SDFDoc.SaveOptions.e_linearized);
                            }
                        } 

let me know if you able to reproduce this bug over your machine.

Many many thanks
Danny
opendoc.pdf
opendoc.xfdf
export_opendoc.pdf

Matt Parizeau

unread,
Jun 17, 2016, 7:08:28 PM6/17/16
to PDFTron WebViewer
Hi Danny,

I'm having trouble reproducing your issue. Here are the steps I took:

1. Downloaded the latest version of PDFNet for .NET 4 from https://www.pdftron.com/pdfnet/downloads.html
2. Modified the FDFTest sample to use your code and point to your XFDF and PDF files.
3. Ran the script.

In the output I can see all 4 of the arrows. See the attached pdf.

What version of PDFNet are you using?

Matt Parizeau
Software Developer
PDFTron Systems Inc.
opendoc.pdf

Danny Mendel

unread,
Jun 20, 2016, 1:07:49 PM6/20/16
to PDFTron WebViewer
Hi Matt,

i'm using 6.2.1, while trying to run latest 6.6.1 all generated xod resulted in 
webviewer display blank pages yet normal thumbnails (the page content shows for split second than becomes white blank constantly)
attached printscreen and the generated 6.6.1 (blank) xod vs generated 6.2.1 (normal display) xod
i notice the 6.2.1 which shown as normal display as double twice bigger the latest 6.6.1 xod generated

the webviewer option i'm using is

myWebViewer = new PDFTron.WebViewer({
                                type: "html5",
                                path: "WebViewer/lib",
                                serverUrl: "https://www.bizzydesklive.com/annotationHandler.aspx",
                                documentType: "xod",
                                enableAnnotations: true,
                                useDownloader: true,
                                showLocalFilePicker: true,
                                mobileRedirect: false,
                                annotationUser: app.username,
                                annotationAdmin: app.username == 'danny' || app.username == 'udi'
                            }, viewerElement);

and use this option for loadDocument call

 var options = {
                    type: "html5",
                    path: "WebViewer/lib",
                    serverUrl: "https://www.maspick.co.il/live/annotationHandler.aspx",
                    documentId: this.sessionId + '~' + this.username + '~' + this.sync.syncmap[0].Value,
                    documentType: "xod",
                    enableAnnotations: true,
                    useDownloader: true,
                    showLocalFilePicker: true,
                    mobileRedirect: false
                }
                myWebViewer.loadDocument(this.sync.syncmap[1].Value, options);


this is why i couldn't test "missing elements" merging with latest dll 
are you aware of this issue ?

let me know what/if i'm doing something wrong , which changed in latest 6.6.1 to make webviewer shows xod as expected?

many many thanks
Danny
white blank webviewer content.png
6.6.1 - blank - Danny Mendel_CV_ENG1.xod
6.2.1 - normal display - Danny Mendel_CV_ENG1.xod

Matt Parizeau

unread,
Jun 21, 2016, 4:15:46 PM6/21/16
to PDFTron WebViewer
Hi Danny,

I can see that the 6.6.1 xod you attached only shows blank pages but having trouble generating a XOD like that. Would you be able to provide the original PDF you converted? As a test I ran the WebViewerConvertTest included in the PDFNet SDK download and all of the test documents seem to have converted without issues.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Danny Mendel

unread,
Jun 21, 2016, 9:02:21 PM6/21/16
to PDFTron WebViewer
Hi Matt,

i also manage to convert any pdf/docx easily with the WebViewerConvertTest ,
however currently i'm using the actual IIS asp.net process to convert rather than launch external commandline service like this sample, and IIS asp.net gives me this white page xod rather than normal xod. i wonder how it works OK with 6.2.1 while with latest 6.6.1 asp.net / IIS fails to produce normal one.

can you discuss this with one of your pdfnet IIS/ASP.net experts, i'm pretty sure i'm not the first one to witness/see this strange behavior.
the machine is regular windows 2012R2 x64 OS machine running on amazon aws instance.

many many thanks
Danny

Matt Parizeau

unread,
Jun 27, 2016, 8:41:04 PM6/27/16
to pdfnet-w...@googlegroups.com
Hi Danny,

We're still having trouble reproducing this even when running in an IIS asp.net process. Here are the steps we took:

1. Download latest version of PDFNet for .NET4.
2. Modify the WebViewerStreaming sample so that ConvertAndStream.aspx calls pdftron.PDF.Convert.toXod.
3. Open the sample in the browser and select the streaming option so that the ConvertAndStream code is run.

We tried a few different files and they all converted without the white page issue.

Could you try performing the steps that we did and see if you can still reproduce the problem. If you can still reproduce can you send a specific PDF file that has the issue as maybe it's something specific to the file.

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages