Free Support Forum -

PDF to PDF/A Conversion inconsistency with transparency

I’ve come across some weird behavior when converting a PDF to PDF/A which contains a image with a transparent background.

Things I’ve notice.
  • Removing the stamps, shows a scaled up image that has a cropped box at the bottom.
  • Removing the Pdf.License converts the document perfectly.
  • If you save the non converted PDF the image will display.

Here an example which produces the problem, with an attached exmaple png which has a transparent background.

var image = Image.Load(“exmaple.png”, new LoadOptions { DataRecoveryMode = DataRecoveryMode.ConsistentRecover });
var imageStream = new MemoryStream();

var pdfDocument = new Document
HideMenubar = true,
HideToolBar = true,
DisplayDocTitle = true,
IsLinearized = true,
OptimizeSize = true,
EmbedStandardFonts = true

pdfDocument.OptimizeResources(new Document.OptimizationOptions
CompressImages = true,
RemoveUnusedStreams = true,
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
ImageQuality = 80
pdfDocument.PageInfo.Margin.Top = pdfDocument.PageInfo.Margin.Bottom = pdfDocument.PageInfo.Margin.Left = pdfDocument.PageInfo.Margin.Right = 200;
pdfDocument.PageInfo.Width = (float)Math.Ceiling(ConvertUtil.PixelToPoint(image.Width, 96.0) + pdfDocument.PageInfo.Margin.Top + pdfDocument.PageInfo.Margin.Bottom);
pdfDocument.PageInfo.Height = (float)Math.Ceiling(ConvertUtil.PixelToPoint(image.Height, 96.0) + pdfDocument.PageInfo.Margin.Left + pdfDocument.PageInfo.Margin.Right);
var pdfImage = new Aspose.Pdf.Image();
var page = pdfDocument.Pages.Add();
pdfImage.ImageStream = imageStream;
var stamp = new TextStamp(“TEST STAMP”);
stamp.TextState.Font = FontRepository.FindFont(“Helvetica”);
stamp.TextState.FontStyle = FontStyles.Regular;
stamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);
stamp.TextState.FontSize = 8.0F;
stamp.TopMargin = 5;
stamp.LeftMargin = 10;
stamp.VerticalAlignment = VerticalAlignment.Bottom;
stamp.HorizontalAlignment = HorizontalAlignment.Left;
pdfDocument.Convert(new MemoryStream(), PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
pdfDocument.Save(“output.pdf”, SaveFormat.Pdf);

Hi Benjamin,

Thanks for using our API’s.

Can you please share the resource PDF file, so that we can test the scenario in our environment. We are sorry for this inconvenience.

Please find attached all the different scenarios of conversion (filename matches scenario)

Hi Benjamin,

Thanks for sharing the resource files.

I am able to notice the issues in shared documents but as requested earlier, please share the input PDF file (before conversion), so that we can test the scenario in our environment. We are sorry for this inconvenience.

There is no input PDF because as the code shows above, I’m converting a Image to PDF than to PDF/A. The attached file above called good_output_without_convertion_pdf-a.pdf is the PDF before it is converted to PDF/A

Hi Benjamin,

Thanks for sharing the details.

I have tested the scenario and have observed that when converting good_output_without_convertion_pdf-a.pdf file to PDF/A_1a format, the image is removed from resultant file. For the sake of correction, I have logged it as PDFNEWNET-40586 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.

8 months have now passed, wondering what the status is on PDFNEWNET-40586? I’ve tested it with the latest .Net PDF version and still observe the same problem.


Hi Benjamin,

Thanks for your patience.

I am afraid the earlier reported issue is not yet resolved as the team has been busy fixing other previously reported high priority issues. However I have intimated the product team to have a look and try accommodating it in their development schedule.

As soon as we have some definite updates regarding its resolution, we will let you know.

Hi Benjamin,

Thanks for your patience.

We are pleased to share that the issue reported earlier is resolved and its fix fill be included in next release of Aspose.Pdf for .NET 17.2.0. Please be patient and wait for new release.

The issues you have found earlier (filed as PDFNET-40586) have been fixed in Aspose.Pdf for .NET 17.2.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.