Convert PDF to PNG using Aspose.PDF for .NET - Form Fields Values are Lost

Hi,

I’m facing an issue when converting some forms PDF to image (Png or Jpeg).

The used PDF (provided in attachment) is a form with several fields.
As we can see at opening the pdf, the fields are filled.
But, when converting to image, all the fields appears empty, with no value.

Here is the code that I use (with Aspose.Pdf v19.7.0.0) :

var pdfFilename = @“D:\Test\PdfForm.pdf”;
var pngFileName = pdfFilename.Replace(".pdf", “.png”);
using (var imageFileStream = new FileStream(pngFileName, FileMode.Create))
{
var pdfDocument = new Document(pdfFilename);
var resolution = new Resolution(300);
var pngDevice = new PngDevice(resolution);
pngDevice.Process(pdfDocument.Pages[1], imageFileStream);
imageFileStream.Close();
}
PdfForm.pdf (265.9 KB)

Can you please figure out why the field values are not embeeded in the created image.
Otherwise, is there any way to detect the lack of field values ?

Regards,

@ThomasNk

We were able to replicate the issue in our environment and logged it as PDFNET-46653 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction.

We are afraid that there is no such way to detect empty fields in an image. However, we will surely share additional updates with you as soon as we have some regarding ticket investigation. Please be patient and spare us little time.

We are sorry for the inconvenience.

To add some input on this subject, this issue seems to be related to the Rectangle property not being set properly. We’ve notice that it has [0,0,0,0] values at runtime.

When we open the faulty pdf (generated by itext-paulo-155) with notepad, we can see this :

/Type /Annot
/T (nom_jeune_fille)
/Rect 145 0 R

endobj
152 0 obj 88.6395
endobj
153 0 obj 519.645
endobj
154 0 obj 547.139
endobj
155 0 obj 535.348
endobj
151 0 obj [152 0 R 153 0 R 154 0 R 155 0 R]
endobj
150 0 obj

When we open another working pdf (generated by Scribus PDF Library 1.4.1) with notepad, we can see this :

/Type /Annot
/T (nom)
/Rect [ 74.00000 519.14000 555.50000 533.89000 ]

To summarize, it seems that Aspose is not able to retrieve Rect values generated by itext-paulo-155.

@ThomasNk

Thanks for sharing more details.

We have logged provided details along with previously logged ticket and it would definitely be helpful during investigation. We will surely let you know in case we have some additional updates. Please spare us little time.

Hello,

Do you have any news regarding this issue.
Can you confirm that Aspose.PDF is only able to deal with direct coordinates for /Rect?
Like this : /Rect [74.00000 519.14000 555.50000 533.89000]

And that it cannot deal with indirect references like :
/Rect 145 0 R
endobj
145 0 obj [224 0 R 225 0 R 226 0 R 227 0 R]
endobj
224 0 obj 74.00000
endobj
225 0 obj 519.14000
endobj
226 0 obj 555.50000
endobj
227 0 obj 533.89000

Thanks

@ThomasNk

Regretfully the ticket is not yet resolved due to other pending high priority issues. Regarding your rectangle processing related query, we will be able to share our feedback once the logged ticket is investigated and resolved. We greatly appreciate your patience and cooperation in this matter. Please spare us some time. We will inform you as soon as logged ticket is resolved.

We are sorry for the inconvenience.

Hi,

Is there any information about this issue?

I’m facing the similar issue. From some reason, when I’m converting PDF to PNG some of the data from first page are lost (screenshot of original and converted in the attachment).

Aspose.PDF - 19.6.0

Using the same code as yours from the issue:

Azure Function v4
Framework .net 6

image.png (86.4 KB)

Screenshot - converted.png (66.9 KB)

@trifke

Can you please try using 23.6 version of the API and if issue still persists, please share your sample code and the sample file with us. We will test the scenario in our environment and address it accordingly.