Here is the basic example I am using to try to debug this issue. It uses the latest Nuget package.
I attached a zip to with the 2 sample pdfs using in the code below.
PdfTest.7z (799.6 KB)
-
model1.pdf - Raw output from our CAD system
-
model1_saved.pdf - The model1.pdf opened with adobe for editing and saved
using System;
using System.IO;
using Aspose.Pdf;
class Program
{
static void Main(string[] args)
{
try
{
var assyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
FileInfo fileInfo = new FileInfo(assyPath);
DirectoryInfo dirInfo = fileInfo.Directory;
//set license
License license = new License();
using (FileStream licenseStream = new FileStream($"{dirInfo.FullName}\\Aspose.PDF.NET.lic", FileMode.Open))
{
try
{
license.SetLicense(licenseStream);
Console.WriteLine("License set successfully.\n");
}
catch (Exception ex)
{
Console.WriteLine($"Unable to set aspose pdf license.\n");
throw ex;
}
}
//This is the pdf directly exported from the cad program.
string docPath = $"{dirInfo.FullName}\\model1.pdf";
using (Document doc = new Document(docPath))
{
Console.WriteLine($"There are {doc.Form.Count} forms in {docPath}.");
foreach (var form in doc.Form)
Console.WriteLine(form.ToString());
}
Console.WriteLine("");
//this is the pdf after opening with adobe and saving. nothing else
string docSavedPath = $"{dirInfo.FullName}\\model1_saved.pdf";
using (Document docSaved = new Document(docSavedPath))
{
Console.WriteLine($"There are {docSaved.Form.Count} forms in {docSavedPath}.");
foreach (var form in docSaved.Form)
Console.WriteLine(form.ToString());
}
Console.WriteLine("");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
}
}
When I run the program Aspose finds 0 forms for the original pdf and 8 for the saved pdf. The output is
License set successfully.
There are 0 forms in C:\Temp\PdfTest\model1.pdf.
There are 8 forms in C:\Temp\PdfTest\model1_saved.pdf.
Aspose.Pdf.Forms.ButtonField
Aspose.Pdf.Forms.ButtonField
Aspose.Pdf.Forms.ButtonField
Aspose.Pdf.Forms.ButtonField
Aspose.Pdf.Forms.ButtonField
Aspose.Pdf.Forms.ButtonField
Aspose.Pdf.Forms.TextBoxField
Aspose.Pdf.Forms.TextBoxField
Press enter to exit.