Working with Aspose.PDF ver 7.4 and Document privileges issue

Hi Murali,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template files.

Well, as your file uses the extended features and if you try to save the file as a new file after filling, it will remove the extended feature and will not allow filling the form. You may check the following link for more details.

Preserve Extended Rights feature while working with Forms

Now, to preserve the extended features (includeing form filling rights), you can use the following sample code as it works fine.

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();

FileStream fs = new FileStream("d:/ap data/november2012/PTO-SB-14+v11-08.pdf", FileMode.Open, FileAccess.ReadWrite);

form.BindPdf(fs);

FileStream xmlInputStream = new FileStream("d:/ap data/november2012/SB14_data.xml", FileMode.Open);

form.ImportXml(xmlInputStream);

xmlInputStream.Close();

form.Save(fs);

fs.Close();

Please feel free to contact support in case you need any further assistance.

Sorry for the inconvenience,

We have tried out as per your technical recommendation,but we are facing the "root element missing" error.

Here is the clear details:

XSLT transformation done based on dataset as input to that.

here is the code:

XmlDataDocument dataXmlDoc = new XmlDataDocument(ds);
XslTransform xslTran = new XslTransform();
//FileStream outputXml = new FileStream();

string tempFile = Path.GetTempFileName();
tempFile = string.Format("{0}\\{1}",
System.Configuration.ConfigurationSettings.AppSettings["RWDirectory"],
Path.GetFileName(tempFile));

FileStream outputXml = new FileStream(tempFile, FileMode.Create);

xslTran.Load(dataXSLTemplate);
xslTran.Transform(dataXmlDoc, null, outputXml);

these OutPutXml passing to importXml.

Metod Call: ImportXml(pdfTemplateStream.Name, outputXml, outputStream.Name);

Method Implementation:

private void ImportXml(string templatePdf, FileStream xml, string destFileName)
{
//Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
//pdfLicense.SetLicense(HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath + "/Aspose.Total.lic.xml"));
//Assign an input pdf file.

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();
form.DestFileName = destFileName;

FileStream fs = new FileStream(templatePdf, FileMode.Open, FileAccess.ReadWrite);
form.BindPdf(fs);

form.ImportXml(xml);
form.Save(fs);
fs.Close();
}

Please find the attached DatasetXml,XSLT file and PDF file.

Hi Murali,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample code and template files.

I am able to reproduce your mentioned issue after an initial test. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34526. You will be notified via this forum thread regarding any update against your reported issue.

Sorry for the inconvenience,

Hi Nausherwan, I remember that last year we already had an issue with dynamic forms (the one attached previously) and drop-down list (when, depending on the value of the drop-down list, some fields are displayed or hidden)

At this time, we had the 5.6 PDF.Kit DLL and we tested the 5.9 one, which fixed our issue (but we did not renew our license at this time)

Question: would it be possible for you to send us the 5.9 DLL? (I checked in the download section for former versions, but could not access the 5.9 one)

Thanks and Regards,
Jerome Gauthier

Hi Murali,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

As per issue id: PDFNEWNET-34526 I have got a feedback from the development team. Please move xml stream position to begin before calling ImportXml() to fix the issue as mentioned below.

form.BindPdf(fs);

outputXml.Seek(0, SeekOrigin.Begin);

form.ImportXml(outputXml);

In our upcoming version of Aspose.Pdf for .NET v7.6, seeking the stream position to begin will be added to Form.ImportXml method so that it is not required explicitly setting.

Regarding availability of Aspose.Pdf for .NET v5.9, I will check it and get back to you.

Sorry for the inconvenience,

Hi Nausherwan,


Any update on the 5.9 PDF.kit.dll? Would it be possible for you to procure it soon as we have a high priority deliverable on-hand.

Thanks for your help.
-Murali
dineshe:
Any update on the 5.9 PDF.kit.dll? Would it be possible for you to procure it soon as we have a high priority deliverable on-hand.
Hi Murali,

Thanks for your patience and sorry for the delayed response.

Aspose.Pdf.Kit for .NET 5.9.0 is quite old release and I am afraid the product release versions older than one year are removed from download section. Furthermore, since Aspose.Pdf.Kit for .NET has been merged into Aspose.Pdf for .NET, we encourage our customers to use the latest release versions.

The issues you have found earlier (filed as PDFNEWNET-34526) have been fixed in Aspose.Pdf for .NET 7.6.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(6)

Hi,


The solution you gave fixed the issue about security, but unfortunately the problem about drop-down list still exist. In the attached generated PDF, you will see on page 3 (“Domestic Benefit/National Stage Information” section, “Prior Application Staus” field) that when drop-down list has the “Patented” value, then the fields that are displayed on the row just after/below are not correct.
If you change the value in the drop-down list to “Pending” (or any other value than “Patented”) then come back again to “Patended”, you will see that the displayed fields become different (4 fields instead of 2)

We had already raised this issue more than one year ago, and this had been fixed with 5.9 Aspose.Pdf DLL version. Now we have made the necessary to renew our license, what can be done to fix this issue asap please?

Regards,
Jerome

Hi Jerome,


Thanks for sharing the details and sorry for delayed response.

I have tested the scenario while using the resource files shared over 426939 link and I have used the code snippet shared against 432765 link and as per my observations, the drop down value is not being selected against field Prior Application Status. Can you please share the data file which can help us in replicating this issue. We are sorry for this inconvenience.

Sorry I’m not sure to understand what you are waiting for. I already attached the PDF that contains the drop-down list. Isn’t it enough? Thanks

Hi Jerome,


As I have shared earlier, when I have used the previously shared PDF file, code snippet and data files, the value of drop down is not being filled. But when I have viewed the resultant PDF file which you have shared, the drop down contains the value. Can you please again share the resource files which can help us in replicating this issue. I have tested the scenario with Aspose.Pdf for .NET 7.6.0. We are really sorry for this inconvenience.

Hi, here is the file (you can find it on http://www.uspto.gov/forms/sb0014.pdf)

Hi Jerome,

Thanks for again sharing the source/template PDF form. I have again tested the scenario using Aspose.Pdf for .NET 7.6.0 while using the attached data files and following code snippet but as per my observations, the “Prior Application Status” drop down present in “Domestic Benefit/National Stage Information” has no value selected. See attached sb0014 - 02Jan2013.pdf which I have just generated. However the PDF file which you have shared SB14-with-patented-problem.pdf contains the value in drop down. Can you please confirm that the data sources which I am using are different or there is some other issue while filling the data in respective form field. We are really sorry for this inconvenience.

[C#]

DataSet ds = new DataSet();

ds.ReadXml(@“c:\pdftest</span>DataSetXml (4).xml”);

XmlDataDocument dataXmlDoc = new XmlDataDocument(ds);

XslTransform xslTran = new XslTransform();

//FileStream outputXml = new FileStream();

string tempFile = “”;

tempFile = @“c:\pdftest\out.xml”;

FileStream outputXml = new FileStream(tempFile, FileMode.Create);

xslTran.Load(@“c:\pdftest</span>PTO-SB-14+XSLT (5).xml”);

xslTran.Transform(dataXmlDoc, null, outputXml);

ImportXml(@“c:\pdftest</span>sb0014 - 02Jan2013.pdf”, outputXml);

<o:p> </o:p>

private void ImportXml(string templatePdf, FileStream xml)

{

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();

//form.DestFileName = destFileName;

FileStream fs = new FileStream(templatePdf, FileMode.Open, FileAccess.ReadWrite);

form.BindPdf(fs);

xml.Seek(0, SeekOrigin.Begin);

form.ImportXml(xml);

form.Save(fs);

fs.Close();

}

Hi Nayyer,

I am not sure to understand where you got your xml data, but to give you an idea, “Patented” data can be found in “”.
And in your xslt you can see that this value is populated by <xsl:for-each select=".//Query15"> but your xml data does not contain any Query15 entry.
If you want to easily check which node corresponds to which data, you can simply open the final PDF file, and make an export in xml from Acrobat Reader.

Can you please retry/investigate using some value in Query15?

Thanks,
Jerome

Any update please?

Hi Jerome,


Thanks for sharing the details and sorry for the late response.

I have tried adding value for Query15 in XML file but I am afraid I am still unable to populate the date in source PDF document. Can you please share the data file which can help us in replicating this issue. We are really sorry for this inconvenience.

As I already told you, you could have simply taken the pdf with problems, and export the data as xml. Then from this xml data you could have tested your ImportXml feature to see the problem…


Anyway please find attached the required file. You will have to locate the node to find the “Patented” case. Then you can see additional information available in sub-nodes.

Regards,
Jerome

Hi Jerome,


Thanks for sharing the resource file.

I have again tested the scenario using data.xml file and xslt file + code snippet shared in 435425 post and as per my observations, nothing seems to be appearing in resultant PDF form. The data does not seem to be present in PDF form. I have used sb0014 (1).pdf as input form.

Can you please again test the scenario at your end.

PS, I have been able to notice the value Patented in source data.xml file. See attached image file.

Is there any way that we can have a call or a webex? Otherwise I am afraid that this issue will never be solved. In addition, what I don’t understand is that when we first raised this issue using Aspose.Pdf.Kit 5.6, your dev team had taken this issue into account and had found a solution in 5.9, so how possible is it that they lost the corresponding changes? Thanks