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

Free Support Forum - aspose.com

Hidden Image Fields appears in png files of output pdf file

I want to hide specific Image field based on some conditions result

I am adding Image FiledType in pdf

Document doc = new Document("input.pdf"));
// Open/Bind document in editor
FormEditor formEditor = new FormEditor(doc);
// Add field
formEditor.AddField(FieldType.Image, "TempField", 1, 120, 150, 220, 250);
formEditor.save("output.pdf");

below is a code to hide “TempField” for specific condition when user open “output.pdf”

Document doc = new Document("output.pdf");
**if(Condition == true)** {
FormEditor frm = new FormEditor(doc);
frm.SetFieldAppearance("TempField", Aspose.Pdf.Annotations.AnnotationFlags.NoView);
frm.Save("outputHidden.pdf"); }

“outputHidden.pdf” does not show “TempField” when i am checking file from the path which is correct behavior.

but when i create png file of “outputHidden.pdf” to represent it on viewer, it shows “TempField” in png image file which is incorrect behavior

I have tried with Aspose.Pdf.Annotations.AnnotationFlags.Hidden,Invisible

Any idea to create png files which hides such a hidden field ?
Please advise.

@123456788,

Kindly send us all input and output documents. We will investigate your scenario in our environment, and share our finds with you.

Export.pdf (73.7 KB)

Attached file contains Image and Text field.
Please provide me an idea about how can i hide those controls in pdf as well as in png image of pdf page.

Below is a sample code to generate fields on pdf

Generating Field

var rect = Aspose.Pdf.Rectangle.FromRect(new System.Drawing.Rectangle((int)shapeX, (int)yaxis, (int)shapeW, (int)shapeH));
TextBoxField rt = new TextBoxField(doc.Pages[1], rect);
rt.Name = “TempField”
using (System.Drawing.Image imgs = System.Drawing.Image.FromFile(img))
{
rt.AddImage(imgs);
}
doc.Form.Add(rt);

Hiding Field

frm.SetFieldAppearance("TempField", Aspose.Pdf.Annotations.AnnotationFlags.NoView);

resultant pdf is not showing “TempField” any more

Converting to Png

i have used PngDevice to get Png File from pdf page.

resultant png file shows the “TempField” in image file

However, Other Pdf to Image conversion tools are hiding the same field in png image when i input same pdf

@123456788,

Based on the initial investigation, we are unable to hide the field in the output PDF document. Kindly send us your input PDF document and the image for the testing purposes. Your response is awaited.

Export.pdf is a self generated PDF file through a sample GitHub code under “Create New File” from upload menu.

I am just placing TextBoxField control and assigning image to it and hiding it run time (while saving) over this PDF.

Opening same pdf file again for preview. [PngDevice class is there which converts PDF page to PNG file and represents on UI, but it does not understand what to hide in output image(through AnnotationFlag=NoView)]

However, same Export.pdf gives me hidden controls when i convert it to png file through other 3rd party tools.

@123456788,

With TextBoxField instance, you can hide field by setting the color of text similar to the background color of page and flattening field as follows:
C#

field.DefaultAppearance = new Aspose.Pdf.Annotations.DefaultAppearance("Calibri", 9, doc.Pages[1].Background.ToRgb());
field.Flatten(); 

We are unable to replicate the said behavior in our environment. If the above lines of code do not help, then please create a small application project, which reproduces this behavior in your environment and share a ZIP of this project.

AsposePDFDemoApp.zip (287.2 KB)

@123456788,

We managed to replicate the said behavior in our environment. It has been logged under the ticket ID PDFNET-44591 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available update.

Any Update on this please ?

@123456788,

The linked ticket ID PDFNET-44591 is pending for the analysis and not resolved yet. We will investigate as per the development schedules, and notify you once it is fixed.

Thanks for prompt response,

We are looking forward to have business license.
Can you please suggest any alternative to avoid this behavior ?

@123456788,

It is difficult to suggest an alternative to avoid this behavior before the completion of the analysis phase. Besides this, we recommend our clients to post their critical issues (or ticket IDs) in the paid support forum. Please refer to this helping link: Aspose support options

Hi,
Right now current version of Editor.js is working fine, if i am uploading the file from file-upload control, But its not working if i am rendering the file from existing location. We have requirement to provide the viewer to user to view the stored list of files on define location. Can you please suggest us to implement the viewer in the same way ?

Regards,
NP

@123456788,

You can convert PDF pages to images, and then use the image control to render images in the project applications. Please refer to this help topic: Convert PDF Pages

Hi Imran,

I want to buy an ASPOSE TOTAL LIBRARY Developer OEM license for my .NET CORE Project.

I do not see “.net core” support anywhere for total library,

Currently i am using nuget package for my .net core package for the same with limitations

Please suggeest the correct total license for .net core.

@123456788,

Thank you for your interest in Aspose APIs. .NET CORE support is recently been added to our APIs. Some of the APIs have stated supporting .NET CORE and for some APIs, the task is in progress. For Aspose.Words, Aspose.PDF & Aspose.Diagram it is supported and for the reset the task is in progress. Please share for which Aspose APIs you are interested in .NET CORE support so that we may share ticket IDs with you respectively.

We are interested in conversion of all the Office family extension’s and PDF extensively.

Please provide License name or type of above requirement for .NET CORE code support,

@123456788,

Currently following Aspose APIs support .NET core.

Aspose.Words
Aspose.Cells
Aspose.Email
Aspose.PDF
Aspose.Diagram
Aspose.BarCode

Aspose.Total is an umbrella package which contains different Aspose APIs. .Net core support is a feature related to every API individually. Listed above are the APIs for which .Net core feature is supported. For other APIs under Aspose.Total, we are working on .Net core feature. You may please list the names of all the Aspose APIs that you are using. This will help us prioritize the functionality of other Aspose APIs.

Furthermore no special license is required for .NET CORE support. Your regular license will work for this feature.

Hello Ikram,

Thanks for prompt response.

Just to make things more clear,
we are intereseted into have a licensed SDK not any web APIs.

However, we are clear with other requirement, that
all the Office family extension’s and PDF extensively + Diagram + Email + Barcode files should able to convert and render into my application. ( I believe there will be a individual class for ex. pngdevice to convert those input files into .png and/or .pdf files to represent it in our application and to work with it in a background )

@123456788,

Aspose components can be used to develop/customize .NET, Java, Android, SharePoint, Reporting Services, and cloud-based applications. Aspose components can be use for document generation, conversion, and automation. Each component is an individual but complete package of functions process different types of documents.

You may get a temporary license for evaluation purpose which will long last for 30 days. Please access the link for details.