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

Free Support Forum - aspose.com

Cannot print generated pdf/a documents

I am using Aspost.Total for .NET to convert various documents to pdf/a. It seems as if the generated pdf-documents are corrupt and I was wondering if there is a fix for this that I can download.

The generated documents appear to be OK. They open in Chrome, Edge and Acrobat. The problem appears when you try to print them. If you try to print the document using Acrobat, you get a messing stating that the file is corrupt.

I have attached two example documents generated using Aspost.Total for .NET.


Best regards,

Håkan

Hi Hakan,


Thanks for contacting support.

I have tried printing both PDF files using Adobe Acrobat 11 where I have used XPS Document Writer as my soft printer and did not notice any error when trying to print Boendeplan+2017-2026.pdf file. However the error message appeared for other document.

Can you please share the input PDF files (from which the PDF/A files are generated), so that we can further look into this matter. We are sorry for this inconvenience.
In this case the original files are in .rtf format and they are converted to pdf/a (PDF_A_1A) using the methods below.

It seems as if documents converted to pdf/a 1a do not conform to the specs, and in some cases this causes print to fail.

When we validate the generated files using online validation tools they report numerous errors and if you open the generated files using a text editor you will notice that the pdf version is 1.5 even though pfd/a 1a should be of version 1.4 according to the specs.

I have attached the .rtf-file you requested.


public static MemoryStream DocToPdfa(Stream fileToConvert, Aspose.Pdf.PdfFormat pf = Aspose.Pdf.PdfFormat.PDF_A_1A)
{
using (MemoryStream d = new MemoryStream())
{
new Aspose.Words.Document(fileToConvert).Save(d, Aspose.Words.SaveFormat.Pdf);
d.Position = 0;
return PdfToPdfa(d, pf);
}
}


public static MemoryStream PdfToPdfa(Stream fileToConvert, Aspose.Pdf.PdfFormat pf = Aspose.Pdf.PdfFormat.PDF_A_1A)
{
MemoryStream d = new MemoryStream();
try
{
using (Aspose.Pdf.Document p = new Aspose.Pdf.Document(fileToConvert))
{
using (MemoryStream l = new MemoryStream())
{
if (p.Convert(l, pf, Aspose.Pdf.ConvertErrorAction.Delete))
{
p.Save(d);
d.Position = 0;
return d;
}
else
{
l.Position = 0;
using (StreamReader sr = new StreamReader(l))
{
throw new Exception(sr.ReadToEnd());
}
}
}
}
}
catch (Exception ex)
{
d.Dispose();
throw ex;
}
}

Thank you very much for your help!

Best regards,
Håkan


Hi Hakan,


Thanks for sharing the sample file.

I have tested the scenario using Aspose.Words for .NET 16.11.0 and Aspose.Pdf for .NET 17.3.0 and I am unable to notice any issue while printing the resultant PDF/A_1b document. I have also noticed that the files which you have shared earlier were created with older release of Aspose.Pdf for .NET 11.8.0, so we recommend you to please try using latest release version.

For your reference, I have also attached the output file generated over my end.

[C#]

DocToPdfa(new FileStream(“c:/pdftest/Yttrande+avseende+motion+Ny+form+av+äldreboende+so.rtf”,
FileMode.Open), PdfFormat.PDF_A_1B);<o:p></o:p>

public static MemoryStream DocToPdfa(Stream fileToConvert, Aspose.Pdf.PdfFormat pf = Aspose.Pdf.PdfFormat.PDF_A_1A)

{

using (MemoryStream d = new MemoryStream())

{

new Aspose.Words.Document(fileToConvert).Save(d, Aspose.Words.SaveFormat.Pdf);

d.Position = 0;

return PdfToPdfa(d, pf);

}

}

public static MemoryStream PdfToPdfa(Stream fileToConvert, Aspose.Pdf.PdfFormat pf = Aspose.Pdf.PdfFormat.PDF_A_1A)

{

MemoryStream d = new MemoryStream();

try

{

using (Aspose.Pdf.Document p = new Aspose.Pdf.Document(fileToConvert))

{

using (MemoryStream l = new MemoryStream())

{

if (p.Convert(l, pf, Aspose.Pdf.ConvertErrorAction.Delete))

{

p.Save("c:/pdftest/Yttrande+avseende+motion+Ny+form+av+äldreboende+so.pdf");

//d.Position = 0;

return null;

}

else

{

l.Position = 0;

using (StreamReader sr = new StreamReader(l))

{

throw new Exception(sr.ReadToEnd());

}

}

}

}

}

catch (Exception ex)

{

d.Dispose();

throw ex;

}

}

}

Hi.

Your attached PDF/A 1B looks good and from what I can tell it conforms to the PDF/A 1B specs. However, we need the documents in PDF/A 1A format.

I downloaded the latest demo version of Aspose Total for .NET but I still got errors when validating the generated pdf.

If you convert the document to PDF/A 1A, does it conform to the specifications? Could you please convert the document to PDF/A 1A and sent it to me?

Best regards ,
Håkan

Hi Hakan,


Thanks for sharing the details.

I have tested the scenario of converting RTF file to PDF/A_1a format and as per my observations, the resultant file is properly visible and also the I am unable to notice any issue while printing the document. For your reference, I have also attached the output files generated over my end.