Raster pdf with hidden layers

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Rasterizer for .NET (v2)  /  Raster pdf with hidden layers

DynamicPDF Rasterizer for .NET (v2) Forum

 Feb 19 2016 9:52 AM
Is it possible to rasterize a PDF page with hidden layers without the hidden layers becoming part of the visible image?

I have tested with Version 1.x and 2.x and when rasterizing your product appears to make all the hidden parts visible on the rastered image.
 Feb 22 2016 11:26 AM
Posted by a ceTe Software moderator
Hello,

Can you please send over the following details to support@cete.com so we can look into it further?

1.Input PDF.
2.Output image.
3.Code sample to recreate the behavior.
4.Exact version and build number of the DynamicPDF Rasterizer DLL file. You can get this information in DLL references properties (Version and Description fields) in Visual Studio.

Thanks,
ceTe Software Support Team.
 Feb 22 2016 12:58 PM
ceTe.DynamicPDF.Rasterizer.40.x86 2.0.0.28903
ceTe.DynamicPDF.40   8.0.0.40

I was able to  find a solution.

If I use the Rasterizer Standalone, it does not include the Hidden layers. 

Sample Code - This did work

 {
            string file = @"c:\\temp\\PDFwithhiddenlayers.pdf";
           
            ceTe.DynamicPDF.Rasterizer.InputPdf miinpdf;
            miinpdf = new InputPdf(file);
         int   pc = miinpdf.Pages.Count;

            for (int i = 0; i < pc; i++)
            {
                

             

                PdfRasterizer rasterizer = new PdfRasterizer(miinpdf);
                string xfile = System.IO.Path.GetFileNameWithoutExtension(file);


                rasterizer.Pages[i].Draw("C:\\temp\\" + xfile + "_" + (i+1) + ".jpg", ImageFormat.Jpeg, ImageSize.Dpi600);
            }




        }




Sample Code - This didn't work 

{
            string file = @"c:\\temp\\PDFwithhiddenlayers.pdf";
            PdfDocument pdfA = new PdfDocument(file);
            int pc = pdfA.Pages.Count;
            pdfA = null;
            string file2 = "C:\\temp\\temp.pdf";
            for (int i = 1; i <= pc; i++)
            {
                Document document = new Document();

                ImportedPage pagec = new ImportedPage(file, i);
                Group grp = pagec.Elements;
                int ii = grp.Count;

                document.Pages.Add(pagec);

             
                document.Draw(file2);
                document = null;

                ceTe.DynamicPDF.Rasterizer.InputPdf miinpdf;
                miinpdf = new InputPdf(file2);

                PdfRasterizer rasterizer = new PdfRasterizer(miinpdf);
                string xfile = System.IO.Path.GetFileNameWithoutExtension(file);


                rasterizer.Pages[0].Draw("C:\\temp\\" + xfile + "_" + (i) + ".jpg", ImageFormat.Jpeg, ImageSize.Dpi600);
            }
 



        }






All times are US Eastern Standard time. The time now is 8:38 AM.