We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Working with Aspose.PDF ver 7.4 and Document privileges issue

We were using Aspose.Pdf components ver 5.6. Planning to move to ver 7.4 and downloaded a trial version of it. When working with ver 5.6, we had the document privileges set into the pdf template and the same used to get carried over when we generated the actual document, referring especially to the “Filling form fields” property. When trying out the same with ver 7.4 of Aspose.pdf dll, we see that the “Filling form fields” property has a value of “Not allowed”. Please see the the attached screenshots that shows the document properties for both versions of Aspose.

We had to make some code changes when trying out ver 7.4 of Aspose.Pdf. Here is the code snipped to ImportXML:

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(templatePdf, destFileName);
xml.Position = 0;
form.ImportXml(xml,true);
form.Save();

Prior to this it was:

Aspose.Pdf.Kit.Form form = new Aspose.Pdf.Kit.Form(templatePdf, destFileName);
xml.Position = 0;
form.ImportXml(xml,true);
form.Save();

We’re nowhere in code explicitly setting any privileges or revoking them. Your help in this matter is appreciated.

Hi Murali,


Thanks for using our products.

Can you please share some resource files which can help us in replicating this issue at our end. We are sorry for your inconvenience.

Hi Shahbaz,

Attached find the pdf template & the XML file containing data. Hope this helps to reproduce the issue on your end.

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.