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.
Raster pdf with hidden layers
Re: Raster pdf with hidden layers
Support · Feb 22, 2016Hello,
Can you please send over the following details to [^a|mailto:support@cete.com|opennewwindow|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.
Re: Raster pdf with hidden layers
Forum member · Feb 22, 2016ceTe.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);
}
}