Hello,
Aspose.Pdf.PdfFormat enum doesn’t contain values for PDF/A-2u and PDF/A-3u compatibility levels. Support for these levels is necessary for our processing. We would like to request this feature in Aspose. Can you add the feature?
Petr Behensky
Hi Petr,
- PDFNET-41491 - PDF to PDF/A-2u - Support this conversion format
- PDFNET-41492 - PDF to PDF/A-3u - Support this conversion format
Hi,
Hi Petr,
hi,
is there any update on this issue?
we’re using aspose total for .net convert to pdf and noted pdf/a-2u is not available in the compliance options.
if its currently not available, is it in aspose roadmap to include this?
kindly advise, thanks.
Hi Chinnam,
Hi,
Hi Benjamin,
Hi Petr,
Thanks for your patience.
Please try using following code snippet to convert PDF file to PDF/A_3U format.
[C#]
PdfFormat format = PdfFormat.PDF_A_3U;
string inFile = "c:/pdftest/XML_input.pdf";
string outFile = "c:/pdftest/XML_input_A_3u.pdf";
string outLog = "c:/pdftest/ConversionLog.xml";
Document doc = new Document(inFile);
PdfFormatConversionOptions opts = new PdfFormatConversionOptions(outLog, format, ConvertErrorAction.Delete);
doc.Convert(opts);
doc.Save(outFile);
Hi Benjamin,
Thanks for your patience.
We are pleased to share that the feature requested earlier to convert PDF file to PDF/A_2U has been implemented and it will become part of upcoming release of Aspose.Pdf for .NET 17.3.0. Once the new version becomes available, please try using following code snippet.
[C#]
string inFile = “input.pdf”;
string outFile = "output.pdf";
// load input PDF file
Document doc = new Document(inFile);
// convert file to PDF/A_2U format
doc.Convert(new MemoryStream(), PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
// save resultant document
doc.Save(outFile);
Hi.
Hi Benjamin,
Hi… thanks for the response. just to confirm the updates will include PDF/A-2U on all aspose products?
The issues you have found earlier (filed as PDFNET-41491) have been fixed in Aspose.Pdf for .NET 17.3.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi Benjamin,bczm8703:Hi.. thanks for the response. just to confirm the updates will include PDF/A-2U on all aspose products?i.e Aspose Words, Cells and Slides too?as the sample code seems to be Aspose.PDF. i would like to confirm if the updates will be done for Words, Cells and Slides too?
hi i tried to convert excel Stream into pdf stream then using this pdf convert to the PDF/A-2U stream. i got the error of root element not found.
it seems that the exception is due to the license file stream. the exception is thrown at function convertPDF2U. it is using the same variable as convert function. how did this error only happen till function convertPDF2U
Hi Benjamin,
Thanks for sharing the details.
I have tested the scenario and observed that in convert method, in last few lines, you instantiated a new Stream object and returned it from method rather than returning the out_stream which contained the Excel to PDF conversion. I have slightly modified the code and I am unable to notice any issue. As per my observations, the Excel file is properly being converted to PDF format.
[C#]
Stream result = Convert(@"C:\Aspose.Total.lic", new FileStream("c:/pdftest/input.xlsx", FileMode.Open));
Stream finalResult = ConvertPDF2U(new FileStream(@"C:\Aspose.Total.lic", FileMode.Open), result);
MessageBox.Show("Conversion Time = " + (DateTime.Now - previous).TotalSeconds);
}
internal static Stream Convert(string licenseFile, Stream excelStream)
{
MemoryStream outStream = new MemoryStream();
Aspose.Cells.License license = new Aspose.Cells.License();
// Pass the full path to the license file or the name of the license file embedded in the assembly
license.SetLicense(licenseFile);
// Instantiate the Workbook object
// Open an Excel file
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(excelStream);
if (!workbook.IsLicensed)
{
// throw new InvalidLicenseException("invalid license file provided");
}
// Implement one page per worksheet option
Aspose.Cells.PdfSaveOptions pdfSaveOptions = new Aspose.Cells.PdfSaveOptions();
pdfSaveOptions.OnePagePerSheet = true;
pdfSaveOptions.Compliance = Aspose.Cells.Rendering.PdfCompliance.PdfA1b;
// Save the document in PDF format
workbook.Save(outStream, pdfSaveOptions);
outStream.Position = 0;
Stream convertedStream = new MemoryStream();
convertedStream.Position = 0;
return outStream;
}
internal static Stream ConvertPDF2U(Stream licenseFile, Stream inputStream)
{
MemoryStream output = new MemoryStream();
Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
pdfLicense.SetLicense(licenseFile);
pdfLicense.Embedded = true;
if (!Aspose.Pdf.Document.IsLicensed)
{
// throw new InvalidLicenseException("invalid license file provided");
}
Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
doc = new Aspose.Pdf.Document(inputStream);
Stream logStream = new MemoryStream();
doc.Convert(logStream, PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
// Save PDF file
doc.Save("c:/pdftest/converted.pdf");
output.Position = 0;
logStream.Dispose();
logStream.Close();
return output;
}