PDF Is Locked

Hi,

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

I am using ASPOSE.PDF.KIT

I am having a PDF template on to which I populate the some field’s data from Data base. Before populating the data (template) the document has no security. But moment I populate the template with database field value and save it with a different name the document is locked.

Now I am in a situation where we don’t need this document to be locked with some system created password.

I want the document to remain unlocked for any edits I wish to do by using PDF writer..

Please help .. I am stuck with this.

Hi Mohan,

Please share the input PDF file along with the code snippet you’re using at your end, so we could reproduce the issue at our end and investigate it. You’ll be updated with the results accordingly.

We’re sorry for the inconvenience.
Regards,

Here you go.. I have my code and template doc attached

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CDF.Common.Utilities;
using CDF.Common.Constants;
using Aspose.Pdf.Kit;
using CDF.DTO.Common;
using CDF.Common.ExceptionManagement;
using System.Data;
using CDF.Common.Enumerations;

namespace CDF.Common.AgreementManagement
{
public class DataMapping
{
///


/// To read License file of Aspose.PDF.Kit.
///

static DataMapping()
{
License license = new License();
license.SetLicense(Utility.GetconfigurationDirectory() + AgreementManagementConstants.ASPOSE_LICENSE_NAME);
}

#region BindEconomicFields
///


/// Bind economic fields in PDF file using Aspose
///

///
///
public string BindEconomicFields(DataSet ds, LoginUserInfo userInfo)
{
string sourceFilepath = string.Empty;
string destinationpath = string.Empty;
string templateName = string.Empty;
Form forms = null;
try
{

sourceFilepath = Utility.GetconfigurationDirectory().Replace(FileNames.DIRECTORY_NAME_CONFIGURATION, FileNames.DIRECTORY_NAME_TEMPLATE) + ds.Tables[0].Rows[0]["TemplateName"].ToString() + FileNames.PDFFileType;
destinationpath = Utility.GetconfigurationDirectory().Replace(FileNames.DIRECTORY_NAME_CONFIGURATION, FileNames.DIRECTORY_NAME_GENERATEDAGREEMENT) + userInfo.userId + FileNames.PDFFileType;

forms = new Form(sourceFilepath, destinationpath);
if (ds.Tables[0].Rows.Count > 0)
{
// Binding data to fields of agreement template.

forms.FillField(AgreementManagementConstants.TName, userInfo.userName);
forms.FillField(AgreementManagementConstants.TJobTitle, userInfo.userRole);

foreach (DataColumn dc in ds.Tables[0].Columns)
{
forms.FillField(dc.ColumnName, ds.Tables[0].Rows[0][dc.ColumnName].ToString());
}
forms.FlattenAllFields();
forms.Save();
}
}
catch (Exception ex)
{

string uiMessage = Utility.GetMessages(MessageConstants.ErrorInBindingDataWithAgreement);
throw new CustomException(LogType.Error, uiMessage, ex);

}
finally
{
forms = null;
sourceFilepath = null;
}
return destinationpath;

}
#endregion

Hi Mohan,

Thank you very much for sharing the input PDF file and sample code. We’ll investigate this issue at our end and you’ll be updated with the results shortly.

Regards,

Hi Mohan,

I have tested this issue at my end using the latest version (5.5.0) and it worked fine. Could you please download the latest version and try at your end as well? If it still doesn’t resolve your issue then please share some more details regarding your working environment: OS, .NET Framework version, and development or deployment environment i.e. Web, Desktop, MOSS etc.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,