Skip to main content
Participating Frequently
July 19, 2025
Question

AVIconCreateFromPDF alternative

  • July 19, 2025
  • 2 replies
  • 231 views

in my adobe acrobat plugin, i am using the AvIconCreateFromPDf to load the icons as pdf files. now i want to load the icons as images like png or jpeg. is there a alternative to AvIconCreateFromPDf that would work for images. Apparently there is a method called AvIconCreateFromFile. I am not sure is this is a valid method that sdk provides.it is not working for me. 

 

2 replies

try67
Community Expert
Community Expert
July 20, 2025

[Question moved to the Acrobat SDK forum]

creative explorer
Community Expert
Community Expert
July 20, 2025

@brilliant_care1058 the reason AvIconCreateFromFile isn't working as you might expect, or why it might not even be a method you can find directly in the public SDK, is that the Adobe Acrobat SDK's AVIcon functions are primarily designed to work with icon resources that are either embedded directly within the PDF structure or are generated from PDF content. The AVIcon mechanism itself is geared towards displaying icons within the Acrobat application's UI, which often has specific requirements for how those visual assets are handled, sometimes preferring vector-based (PDF) content for scalability and crispness. While the SDK offers ways to work with various file types in other contexts, directly loading raster image formats like PNG or JPEG as an AVIcon might not be a first-class, direct function call within the AVIcon family, or it might require a specific internal conversion process that isn't exposed through a simple CreateFromFile method for arbitrary image formats.

The most reliable solution for incorporating PNG or JPEG images as icons within your Acrobat plugin's UI, given the SDK's typical design, would involve an intermediate step where you first convert your image files into a PDF representation that Acrobat can then use. You would: Programmatically convert your PNG/JPEG image into a single-page PDF document. Many third-party libraries or even system-level tools (depending on your development environment and language) can achieve this. You'd essentially be creating a temporary PDF where the image is the sole content of a page.


Once you have the image as a PDF, you can then use your existing and reliable AVIconCreateFromPDF function to load this newly created PDF and generate the AVIcon you need. This approach leverages the method you know works (AvIconCreateFromPDF) by providing it with content it understands, effectively bridging the gap between your image files and Acrobat's icon requirements. While it adds a conversion step, it's a common pattern in SDKs where specific internal formats are preferred for UI elements, ensuring compatibility and consistent rendering within the application.

m
Participating Frequently
July 20, 2025

Thank u for the reply. I am aware of this step but the very reason I want to use the image is because I ran into very weird problem. While I load the icon through a pdf, the toolbar icon displays the white background of the pdf as well. Our Adobe plugin is going through some branding changes so I needed to change the icon. Our old icon was getting displayed properly however, the new icon I am load is not. Is there a way to overcome this issue? Since loading the icon from the pdf is the most common way, there has to be a solution right? I tried to run the image through some background removing softwares but its no use. When converting to pdf image always has a white background. I have added our new and old logo for refremce