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

Free Support Forum - aspose.com

PDF to PDF-A questions

Hello, I have two different issues when working with PDF to PDF-A conversion.

1.) I need to verify if a PDF document is digitally signed. When I use the code snippet below I receive a Null Reference Exception on the fileSignature.ContainsSignature call. In fact when I debug I can see that a lot of the PDFFileSignature properties have a null reference exception. I have attached the document I've been using for this test (dsigned.pdf).

Aspose.Pdf.Document pdffDocument = new Aspose.Pdf.Document(inputFileName);
Aspose.Pdf.Facades.PdfFileSignature fileSignature = new Aspose.Pdf.Facades.PdfFileSignature();

bool isSigned = false;
fileSignature.BindPdf(pdffDocument);
if (fileSignature.ContainsSignature())
{
isSigned = true;
}
fileSignature.Close();

2.) The documents I've been testing with all fail the validation functions that Aspose uses; Pdf.Document.IsPdfaCompliant and Pdf.Document.Validate. Does Aspose convert not address these compliance issues. How can I look to correct them. I've attached document I've been using for this issue (Standard.pdf).

3.) See Reply 692217. I've attached the document I've been using for this issue (Standard.pdf).

4.) When trying to optimize and save the attached document (multipart.pdf) I'm getting a "Object reference not set to an instance of an object." error during the Pdf.Document.Save(). Code snippet below.

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(inputFileName);
pdfDocument.Convert("log.xml", format, ConvertErrorAction.Delete);
pdfDocument.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true
});

pdfDocument.Save(outputFileName);


I'm using Aspose.Pdf v11.0

Thank you in advance for any help you can provide.

3.) Found a semi-solution for this issue. Performing a OptimizeResources on the document before a Convert resulted in a lower result file size (15kb to 845kb in my case).


Is this file size ratio going to be the best Aspose can do?
My results are failing the Validate function and are not showing they’re pdfa when opened. This ties into my second question, what can I do to make sure they pass this validation?

Nathan.Ramirez:

1.) I need to verify if a PDF document is digitally signed. When I use the code snippet below I receive a Null Reference Exception on the fileSignature.ContainsSignature call. In fact when I debug I can see that a lot of the PDFFileSignature properties have a null reference exception. I have attached the document I’ve been using for this test (dsigned.pdf).

Aspose.Pdf.Document pdffDocument = new Aspose.Pdf.Document(inputFileName);
Aspose.Pdf.Facades.PdfFileSignature fileSignature = new Aspose.Pdf.Facades.PdfFileSignature();

bool isSigned = false;
fileSignature.BindPdf(pdffDocument);
if (fileSignature.ContainsSignature())
{
isSigned = true;
}
fileSignature.Close();
Hi Nathan,

Thanks for contacting support.

I have tested the scenario and have managed to reproduce the same problem. For the sake of correction, I have logged this problem
as
PDFNEWNET-40313 in our issue tracking system.

Nathan.Ramirez:
2.) The documents I’ve been testing with all fail the validation functions that Aspose uses; Pdf.Document.IsPdfaCompliant and Pdf.Document.Validate. Does Aspose convert not address these compliance issues. How can I look to correct them. I’ve attached document I’ve been using for this issue (Standard.pdf).
The resource PDF file is not PDF/A compliant. However I have tested the scenario of PDF to PDF/A_1b conversion and as per my observations, the resultant file is not PDF/A_1b compliant. For the sake of correction, I have separately logged this problem
as
PDFNEWNET-40314 in our issue tracking system.

Nathan.Ramirez:
4.) When trying to optimize and save the attached document (multipart.pdf) I’m getting a “Object reference not set to an instance of an object.” error during the Pdf.Document.Save(). Code snippet below.

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(inputFileName);
pdfDocument.Convert(“log.xml”, format, ConvertErrorAction.Delete);
pdfDocument.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true
});

pdfDocument.Save(outputFileName);


I’m using Aspose.Pdf v11.0

Thank you in advance for any help you can provide.
I am afraid I am unable to find multipart.pdf file in earlier posts. Can you please again try attaching the document.

Also please note that in order optimize the PDF file size, you do not need to perform conversion to PDF/A.

We are sorry for your inconvenience.
My apologies, I forgot to upload that document. You'll now find it attached to this reply (Double.pdf).

I've done an optimize call both before the conversion and after, and found that the file size was smaller when implemented after the convert to pdf-a. How else am I able to get the result file size lower?

Thank you so much for your help.
Nathan.Ramirez:
4.) When trying to optimize and save the attached document (multipart.pdf) I'm getting a "Object reference not set to an instance of an object." error during the Pdf.Document.Save(). Code snippet below.

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(inputFileName);
pdfDocument.Convert("log.xml", format, ConvertErrorAction.Delete);
pdfDocument.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true
});

pdfDocument.Save(outputFileName);

Hi Nathan,

Thanks for sharing the resource file.

I have tested the scenario using latest release of Aspose.Pdf for .NET 11.3.0 and I am unable to notice any issue. For your reference, I have also attached the output file generated over my end. However the size of document is not much optimized.

Please note that NullReferenceException occurs when you try to convert PDF files to PDf/A_1b format and then try optimizing the document.

Hi Nayyer,



Thanks for all the help so far. Can you take a look at the Double.pdf issue again. I downloaded and tested using the Aspose.Pdf 11.3 and am still getting a null reference error. I’ve attached the code and stack trace for this.



It also may be of note that this neither passes compliance validation nor does it present itself as Pdf-a when opened.



Thank you so much.

Hi Nathan,


Thanks for sharing the resource files.

I have tested the scenario and have managed to reproduce the same issue that images are not being rendering inside PDF file when referenced from network path.For the sake of correction, I have logged it as PDFNEWNET-40338 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Hello,

I was wondering if any corrections have been made in response to the issues in this thread?

PDFNEWNET-40313
PDFNEWNET-40314
PDFNEWNET-40338

Thank you

Hi Nathan,


Thanks for your inquiry. I am afraid your issues are still not resolved, as we have noticed the issues recently and these are pending for investigation in the queue. We will share any ETAs/findings with you as soon as our product team completes the issues’ investigation. We will keep you updated about issues’ resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

Hello, and thank you for your time.

This is in reference to PDFNEWNET-40338. I’m wondering if there’s anything I can do to the document on my side to help resolve the issue?

Hi Nathan,


Thanks for your patience.

I am afraid the issues reported earlier are still pending for review and I am afraid they are not yet resolved. Please note that until or unless product team has started investigating these issues, we might not be able to share any possible solution regarding these issues. Please be patient and wait for the resolution.

The issues you have found earlier (filed as PDFNET-40313) have been fixed in Aspose.PDF for .NET 19.4.