PdfConverter Issue for Hidden Field

Hi,

I used PdfConverter for Convert from PDF file to Image

PdfConverter converter = new PdfConverter();
converter.BindPdf(inFile);
converter.DoConvert();
while (converter.HasNextImage())
{
string imageOut = a_DirOutPut + "\\" + Guid.NewGuid() + suffix;
converter.GetNextImage(imageOut, System.Drawing.Imaging.ImageFormat.Jpeg);
arrListImage.Add(imageOut);
}

Problem: In Pdf file I have some field hidden when Convert to image then hidden it display in Image. Output work well but some field hidden I don't want it output into Image but It outputed into image it not good for this.

I had solution for this but it not good, I filled blank text for all field hidden beforce convert it to image it work well. I must lost one step merge again pdf for this case.

Hi Toan,

I have tested this issue at my end by setting the AnnotationFlag as NoView and it worked fine. The field is neither shown in PDF nor on the image when converted. Please use as given below:


formEditor.SetFieldAppearance(“text2”,AnnotationFlag.NoView);



When you use Hidden, it only hides the field in PDF and not in the converted image.

I hope this helps. If you have any other issues, please do let us know.
Regards,

Thank you Shahzad, it will help me for case merge data I will set it NoView or when convert pdf to image i will set field hidden with NoView :).

It did not worked in my case.

Document doc = new Document("input.pdf");
FormEditor frm = new FormEditor(doc);
frm.SetFieldAppearance("tempfield", Aspose.Pdf.Annotations.AnnotationFlags.NoView);
frm.Save("output.pdf");

Ouput.pdf is hiding the “tempfield” but when i create png file from ‘output.pdf’ it’s still there.

@123456788,

Kindly send us your source PDF document. We will investigate your scenario in our environment, and share our findings 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,

We have answered the same query in your other thread. Please refer to this reply: