I want to convert this code into PHP, it's a function that hides layers on a PDF file, but I don't understand how it is doing it.
public static void HidePDFLayers(string pdf_file, string output_file)
{
PdfReader reader = new PdfReader(pdf_file);
PdfStamper stamp = new PdfStamper(reader, new FileStream(output_file, FileMode.Create));
pdf_num_pages = reader.NumberOfPages;
Dictionary<string, PdfLayer> layers = stamp.GetPdfLayers();
int count = 0;
foreach(KeyValuePair<string, PdfLayer> entry in layers )
{
PdfLayer layer = (PdfLayer)entry.Value;
layer.On = false;
count++;
}
stamp.Close();
Console.WriteLine("[*] Number Of Layers Hidden: " + count);
PDFToImages(output_file);
}
Does this create a new PDF with all the layers hidden (which layers, surely if they were all hidden then there would be nothing on the PDF?)
How would I do the same with PHP?